Skip to content

Commit

Permalink
Project import generated by Copybara.
Browse files Browse the repository at this point in the history
FolderOrigin-RevId: /usr/local/google/home/gdennis/copybara/temp/folder-destination1942009350563619035/.
  • Loading branch information
GGN Engprod Team authored and greg-dennis committed May 30, 2023
1 parent ca65713 commit 15b391d
Show file tree
Hide file tree
Showing 13 changed files with 44,308 additions and 43,752 deletions.
8 changes: 4 additions & 4 deletions binding/portgraph/combos.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ func (g *nodeGenerator) recurse(nodes []*AbstractNode) bool {
g.res[first] = n
g.used[n] = true
if !g.recurse(nodes[1:]) {
delete(g.conNode2Node2NeedPorts, n)
for k := range g.conNode2Node2NeedPorts[n] {
delete(g.conNode2Node2NeedPorts[k], n)
}
return false
}
delete(g.used, n)
delete(g.res, first)
for k := range g.conNode2Node2NeedPorts[n] {
delete(g.conNode2Node2NeedPorts[k], n)
}
delete(g.conNode2Node2NeedPorts, n)
}
}
return true
Expand Down
29 changes: 25 additions & 4 deletions binding/portgraph/portgraph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ var (
node3port2 = &ConcretePort{Desc: "node3:port2"}
node4port1 = &ConcretePort{Desc: "node4:port1"}
node4port2 = &ConcretePort{Desc: "node4:port2"}
node5port1 = &ConcretePort{Desc: "node5:port1"}
node6port1 = &ConcretePort{Desc: "node6:port1"}
node7port1 = &ConcretePort{Desc: "node7:port1"}
node8port1 = &ConcretePort{Desc: "node8:port1"}
node9port1 = &ConcretePort{Desc: "node9:port1"}
node9port1 = &ConcretePort{Desc: "node9:port1", Attrs: map[string]string{"attr": "node9port1"}}
node10port1 = &ConcretePort{Desc: "node10:port1"}
node10port2 = &ConcretePort{Desc: "node10:port2"}
node11port1 = &ConcretePort{Desc: "node11:port1"}
Expand Down Expand Up @@ -145,9 +148,9 @@ var (
node2 = &ConcreteNode{Desc: "node2", Ports: []*ConcretePort{node2port1, node2port2}, Attrs: map[string]string{"vendor": "CISCO2"}}
node3 = &ConcreteNode{Desc: "node3", Ports: []*ConcretePort{node3port1, node3port2}, Attrs: map[string]string{"vendor": "CISCO3"}}
node4 = &ConcreteNode{Desc: "node4", Ports: []*ConcretePort{node4port1, node4port2}, Attrs: map[string]string{"vendor": "CISCO4"}}
node5 = &ConcreteNode{Desc: "node5", Attrs: map[string]string{"vendor": "CISCO1"}}
node6 = &ConcreteNode{Desc: "node6", Attrs: map[string]string{"vendor": "CISCO2"}}
node7 = &ConcreteNode{Desc: "node7", Attrs: map[string]string{"vendor": "CISCO3"}}
node5 = &ConcreteNode{Desc: "node5", Ports: []*ConcretePort{node5port1}, Attrs: map[string]string{"vendor": "CISCO1"}}
node6 = &ConcreteNode{Desc: "node6", Ports: []*ConcretePort{node6port1}, Attrs: map[string]string{"vendor": "CISCO2"}}
node7 = &ConcreteNode{Desc: "node7", Ports: []*ConcretePort{node7port1}, Attrs: map[string]string{"vendor": "CISCO3"}}
node8 = &ConcreteNode{Desc: "node8", Ports: []*ConcretePort{node8port1}, Attrs: map[string]string{"attr": ""}}
node9 = &ConcreteNode{Desc: "node9", Ports: []*ConcretePort{node9port1}, Attrs: map[string]string{"vendor": "UNIQUE9"}}
// Four Nodes, interconnected; include additional Nodes with enough ports but not enough edges.
Expand Down Expand Up @@ -221,6 +224,9 @@ var superGraph = &ConcreteGraph{
{Src: node1port2, Dst: node4port1},
{Src: node2port2, Dst: node3port1},
{Src: node3port2, Dst: node4port2},
{Src: node5port1, Dst: node8port1},
{Src: node6port1, Dst: node8port1},
{Src: node7port1, Dst: node8port1},
{Src: node8port1, Dst: node9port1},
// 4 interconnected nodes
{Src: node10port1, Dst: node14port1},
Expand Down Expand Up @@ -414,6 +420,12 @@ var (
abs22port3 = &AbstractPort{Desc: "abs22:port3"}
abs22port4 = &AbstractPort{Desc: "abs22:port4", Constraints: map[string]PortConstraint{"attr3": SameAsPort(abs21port1)}}
abs22port5 = &AbstractPort{Desc: "abs22:port5", Constraints: map[string]PortConstraint{"attr4": SameAsPort(abs21port1)}}

// 2 nodes, one link. Checking that many working nodes doesn't cause match issues.
abs23 = &AbstractNode{Desc: "abs23", Ports: []*AbstractPort{abs23port1}, Constraints: map[string]NodeConstraint{"attr": Equal("")}}
abs24 = &AbstractNode{Desc: "abs24", Ports: []*AbstractPort{abs24port1}}
abs23port1 = &AbstractPort{Desc: "abs23:port1"}
abs24port1 = &AbstractPort{Desc: "abs24:port1", Constraints: map[string]PortConstraint{"attr": Equal("node9port1")}}
)

func TestSolve(t *testing.T) {
Expand Down Expand Up @@ -608,6 +620,15 @@ func TestSolve(t *testing.T) {
abs22port4: node81port4,
abs22port5: node81port5,
},
}, {
desc: "2 nodes, 1 link; multiple possible nodes for second node",
graph: &AbstractGraph{
Desc: "2 nodes, 1 link; multiple possible nodes for second node",
Nodes: []*AbstractNode{abs23, abs24},
Edges: []*AbstractEdge{{abs23port1, abs24port1}},
},
wantNodes: map[*AbstractNode]*ConcreteNode{abs23: node8, abs24: node9},
wantPorts: map[*AbstractPort]*ConcretePort{abs23port1: node8port1, abs24port1: node9port1},
}}
for _, tc := range tests {
t.Run(tc.desc, func(t *testing.T) {
Expand Down
29 changes: 29 additions & 0 deletions gnmi/oc/enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -3722,6 +3722,35 @@ const (
IfIp_IpAddressOrigin_RANDOM E_IfIp_IpAddressOrigin = 5
)

// E_IfIp_Ipv4AddressType is a derived int64 type which is used to represent
// the enumerated node IfIp_Ipv4AddressType. An additional value named
// IfIp_Ipv4AddressType_UNSET is added to the enumeration which is used as
// the nil value, indicating that the enumeration was not explicitly set by
// the program importing the generated structures.
type E_IfIp_Ipv4AddressType int64

// IsYANGGoEnum ensures that IfIp_Ipv4AddressType implements the yang.GoEnum
// interface. This ensures that IfIp_Ipv4AddressType can be identified as a
// mapped type for a YANG enumeration.
func (E_IfIp_Ipv4AddressType) IsYANGGoEnum() {}

// ΛMap returns the value lookup map associated with IfIp_Ipv4AddressType.
func (E_IfIp_Ipv4AddressType) ΛMap() map[string]map[int64]ygot.EnumDefinition { return ΛEnum }

// String returns a logging-friendly string for E_IfIp_Ipv4AddressType.
func (e E_IfIp_Ipv4AddressType) String() string {
return ygot.EnumLogString(e, int64(e), "E_IfIp_Ipv4AddressType")
}

const (
// IfIp_Ipv4AddressType_UNSET corresponds to the value UNSET of IfIp_Ipv4AddressType
IfIp_Ipv4AddressType_UNSET E_IfIp_Ipv4AddressType = 0
// IfIp_Ipv4AddressType_PRIMARY corresponds to the value PRIMARY of IfIp_Ipv4AddressType
IfIp_Ipv4AddressType_PRIMARY E_IfIp_Ipv4AddressType = 1
// IfIp_Ipv4AddressType_SECONDARY corresponds to the value SECONDARY of IfIp_Ipv4AddressType
IfIp_Ipv4AddressType_SECONDARY E_IfIp_Ipv4AddressType = 2
)

// E_IfIp_Ipv6AddressType is a derived int64 type which is used to represent
// the enumerated node IfIp_Ipv6AddressType. An additional value named
// IfIp_Ipv6AddressType_UNSET is added to the enumeration which is used as
Expand Down
10 changes: 10 additions & 0 deletions gnmi/oc/enum_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,10 @@ var ΛEnum = map[string]map[int64]ygot.EnumDefinition{
4: {Name: "LINK_LAYER"},
5: {Name: "RANDOM"},
},
"E_IfIp_Ipv4AddressType": {
1: {Name: "PRIMARY"},
2: {Name: "SECONDARY"},
},
"E_IfIp_Ipv6AddressType": {
1: {Name: "GLOBAL_UNICAST"},
2: {Name: "LINK_LOCAL_UNICAST"},
Expand Down Expand Up @@ -2594,6 +2598,9 @@ func initΛEnumTypes() {
"/interfaces/interface/routed-vlan/ipv4/addresses/address/state/origin": {
reflect.TypeOf((E_IfIp_IpAddressOrigin)(0)),
},
"/interfaces/interface/routed-vlan/ipv4/addresses/address/state/type": {
reflect.TypeOf((E_IfIp_Ipv4AddressType)(0)),
},
"/interfaces/interface/routed-vlan/ipv4/neighbors/neighbor/state/origin": {
reflect.TypeOf((E_IfIp_NeighborOrigin)(0)),
},
Expand Down Expand Up @@ -2633,6 +2640,9 @@ func initΛEnumTypes() {
"/interfaces/interface/subinterfaces/subinterface/ipv4/addresses/address/state/origin": {
reflect.TypeOf((E_IfIp_IpAddressOrigin)(0)),
},
"/interfaces/interface/subinterfaces/subinterface/ipv4/addresses/address/state/type": {
reflect.TypeOf((E_IfIp_Ipv4AddressType)(0)),
},
"/interfaces/interface/subinterfaces/subinterface/ipv4/neighbors/neighbor/state/origin": {
reflect.TypeOf((E_IfIp_NeighborOrigin)(0)),
},
Expand Down
Loading

0 comments on commit 15b391d

Please sign in to comment.