Skip to content

Commit

Permalink
Only retain management_instance of used router
Browse files Browse the repository at this point in the history
  • Loading branch information
hknutzen committed Apr 9, 2024
1 parent 86e591f commit 27c4b11
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go/pkg/pass1/cut-netspoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ func (c *spoc) cutNetspoc(

// Mark management_instance of routers
for _, r := range c.managedRouters {
if r.model.needManagementInstance {
if isUsed[r.name] && r.model.needManagementInstance {
if mr := c.getRouter(r.deviceName, r.ipV6); mr != nil {
for _, intf := range getIntf(mr) {
setIntfUsed(intf, isUsed)
Expand Down
23 changes: 22 additions & 1 deletion go/testdata/cut-netspoc/cut-netspoc.t
Original file line number Diff line number Diff line change
Expand Up @@ -3485,7 +3485,7 @@ service:s1 = {
=END=
############################################################
=TITLE=Retain management_instance
=TITLE=Retain management_instance of used router
=TEMPL=input
network:n1 = { ip = 10.1.1.0/24; }
network:n2 = { ip = 10.1.2.0/24; }
Expand Down Expand Up @@ -3516,4 +3516,25 @@ service:s1 = {
[[input]]
=OUTPUT=
[[input]]
=END=
############################################################
=TITLE=Ignore management_instance of unused router
=INPUT=
[[input]]
router:r2 = {
model = NSX;
management_instance;
interface:n3 = { ip = 10.1.3.2; }
}
router:r2@v1 = {
model = NSX, T0;
managed;
routing = manual;
interface:n3 = { ip = 10.1.3.2; hardware = IN; }
interface:n4 = { ip = 10.1.4.1; hardware = OUT; }
}
network:n4 = { ip = 10.1.4.0/24; }
=OUTPUT=
[[input]]
=END=

0 comments on commit 27c4b11

Please sign in to comment.