Beispiel #1
0
    def as_path (self):
        if not self.as_path_:

            def path_order (p1, p2):

                i1 = p1.feature().implicit()
                i2 = p2.feature().implicit()

                if i1 != i2:
                    return i2 - i1
                else:
                    return cmp(p1.feature().name(), p2.feature().name())

            # trim redundancy
            properties = feature.minimize(self.base_)

            # sort according to path_order
            properties.sort (path_order)

            components = []
            for p in properties:
                if p.feature().implicit():
                    components.append(p.value())
                else:
                    value = p.feature().name() + "-" + p.value()
                    if property.get_abbreviated_paths():
                        value = abbreviate_dashed(value)
                    components.append(value)

            self.as_path_ = '/'.join (components)

        return self.as_path_
Beispiel #2
0
    def as_path (self):
        if not self.as_path_:

            def path_order (p1, p2):

                i1 = p1.feature().implicit()
                i2 = p2.feature().implicit()

                if i1 != i2:
                    return i2 - i1
                else:
                    return cmp(p1.feature().name(), p2.feature().name())

            # trim redundancy
            properties = feature.minimize(self.base_)

            # sort according to path_order
            properties.sort (path_order)

            components = []
            for p in properties:
                if p.feature().implicit():
                    components.append(p.value())
                else:
                    value = p.feature().name() + "-" + p.value()
                    if property.get_abbreviated_paths():
                        value = abbreviate_dashed(value)
                    components.append(value)

            self.as_path_ = '/'.join (components)

        return self.as_path_