Skip to content

Commit

Permalink
Fix switch test.
Browse files Browse the repository at this point in the history
  • Loading branch information
patfair committed Sep 26, 2023
1 parent 7c69a3f commit 914f458
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions network/switch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ func TestConfigureSwitch(t *testing.T) {
// Should remove any existing teams but not other SSIDs.
sw.port += 1
mockTelnet(t, sw.port,
"interface Vlan100\nip address 10.0.100.2\ninterface Vlan50\nip address 10.2.54.61\n", &command)
"interface Vlan100\nip address 10.0.100.2\ninterface Vlan50\nip address 10.2.54.1\n", &command)
assert.Nil(t, sw.ConfigureTeamEthernet([6]*model.Team{nil, nil, nil, nil, nil, nil}))
assert.Equal(t, "password\nenable\npassword\nterminal length 0\nconfig terminal\ninterface Vlan50\nno ip"+
" address\nno access-list 150\nend\ncopy running-config startup-config\n\nexit\n", command)

// Should configure new teams and leave existing ones alone if still needed.
sw.port += 1
mockTelnet(t, sw.port, "interface Vlan50\nip address 10.2.54.61\n", &command)
mockTelnet(t, sw.port, "interface Vlan50\nip address 10.2.54.1\n", &command)
assert.Nil(t, sw.ConfigureTeamEthernet([6]*model.Team{nil, &model.Team{Id: 1114}, nil, nil, &model.Team{Id: 254},
nil}))
assert.Equal(t, "password\nenable\npassword\nterminal length 0\nconfig terminal\n"+
"ip dhcp excluded-address 10.11.14.1 10.11.14.100\nno ip dhcp pool dhcp20\nip dhcp pool dhcp20\n"+
"network 10.11.14.0 255.255.255.0\ndefault-router 10.11.14.61\nlease 7\nno access-list 120\n"+
"network 10.11.14.0 255.255.255.0\ndefault-router 10.11.14.1\nlease 7\nno access-list 120\n"+
"access-list 120 permit ip 10.11.14.0 0.0.0.255 host 10.0.100.5\n"+
"access-list 120 permit udp any eq bootpc any eq bootps\ninterface Vlan20\n"+
"ip address 10.11.14.61 255.255.255.0\nend\ncopy running-config startup-config\n\nexit\n", command)
"ip address 10.11.14.1 255.255.255.0\nend\ncopy running-config startup-config\n\nexit\n", command)
}

func mockTelnet(t *testing.T, port int, response string, command *string) {
Expand Down

0 comments on commit 914f458

Please sign in to comment.