MCPcopy
hub / github.com/osrg/gobgp / NewExtCommunitySet

Function NewExtCommunitySet

internal/pkg/table/policy.go:1755–1783  ·  view source on GitHub ↗
(c oc.ExtCommunitySet)

Source from the content-addressed store, hash-verified

1753}
1754
1755func NewExtCommunitySet(c oc.ExtCommunitySet) (*ExtCommunitySet, error) {
1756 name := c.ExtCommunitySetName
1757 if name == "" {
1758 if len(c.ExtCommunityList) == 0 {
1759 return nil, nil
1760 }
1761 return nil, fmt.Errorf("empty ext-community set name")
1762 }
1763 list := make([]*regexp.Regexp, 0, len(c.ExtCommunityList))
1764 subtypeList := make([]bgp.ExtendedCommunityAttrSubType, 0, len(c.ExtCommunityList))
1765 for _, x := range c.ExtCommunityList {
1766 subtype, exp, err := ParseExtCommunityRegexp(x)
1767 if err != nil {
1768 return nil, err
1769 }
1770 list = append(list, exp)
1771 subtypeList = append(subtypeList, subtype)
1772 }
1773 s := &ExtCommunitySet{
1774 regExpSet: regExpSet{
1775 typ: DEFINED_TYPE_EXT_COMMUNITY,
1776 name: name,
1777 list: list,
1778 },
1779 subtypeList: subtypeList,
1780 }
1781 s.rebuildExtMatchers()
1782 return s, nil
1783}
1784
1785func (s *ExtCommunitySet) Append(arg DefinedSet) error {
1786 if err := s.regExpSet.Append(arg); err != nil {

Calls 2

rebuildExtMatchersMethod · 0.95
ParseExtCommunityRegexpFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…