Skip to content

Commit

Permalink
Merge pull request #455 from jojimt/np-restart
Browse files Browse the repository at this point in the history
Fix netplugin restart issue in ACI mode
  • Loading branch information
jojimt committed Jul 13, 2016
2 parents f1bb86f + 72f0d35 commit 6e0d485
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
15 changes: 8 additions & 7 deletions drivers/ovsSwitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (sw *OvsSwitch) CreatePort(intfName string, cfgEp *mastercfg.CfgEndpointSta
}

// UpdatePort updates an OVS port without creating it
func (sw *OvsSwitch) UpdatePort(intfName string, cfgEp *mastercfg.CfgEndpointState, pktTag int, skipVethPair bool) error {
func (sw *OvsSwitch) UpdatePort(intfName string, cfgEp *mastercfg.CfgEndpointState, pktTag, nwPktTag int, skipVethPair bool) error {

// Get OVS port name
ovsPortName := getOvsPortName(intfName, skipVethPair)
Expand All @@ -356,12 +356,13 @@ func (sw *OvsSwitch) UpdatePort(intfName string, cfgEp *mastercfg.CfgEndpointSta

// Build the endpoint info
endpoint := ofnet.EndpointInfo{
PortNo: ofpPort,
MacAddr: macAddr,
Vlan: uint16(pktTag),
IpAddr: net.ParseIP(cfgEp.IPAddress),
Ipv6Addr: net.ParseIP(cfgEp.IPv6Address),
EndpointGroup: cfgEp.EndpointGroupID,
PortNo: ofpPort,
MacAddr: macAddr,
Vlan: uint16(nwPktTag),
IpAddr: net.ParseIP(cfgEp.IPAddress),
Ipv6Addr: net.ParseIP(cfgEp.IPv6Address),
EndpointGroup: cfgEp.EndpointGroupID,
EndpointGroupVlan: uint16(pktTag),
}

// Add the local port to ofnet
Expand Down
2 changes: 1 addition & 1 deletion drivers/ovsdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func (d *OvsDriver) CreateEndpoint(id string) error {
log.Printf("Found matching oper state for ep %s, noop", id)

// Ask the switch to update the port
err = sw.UpdatePort(operEp.PortName, cfgEp, pktTag, skipVethPair)
err = sw.UpdatePort(operEp.PortName, cfgEp, pktTag, cfgNw.PktTag, skipVethPair)
if err != nil {
log.Errorf("Error creating port %s. Err: %v", intfName, err)
return err
Expand Down
15 changes: 15 additions & 0 deletions systemtests/aci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ func (s *systemtestSuite) TestACIMode(c *C) {
// Verify cA1 cannot ping cB1
c.Assert(cA1.checkPingFailure(cB1.eth0.ip), IsNil)

log.Infof("Triggering netplugin restart")
node1 := s.nodes[0]
c.Assert(node1.stopNetplugin(), IsNil)
c.Assert(node1.rotateLog("netplugin"), IsNil)
c.Assert(node1.startNetplugin(""), IsNil)
c.Assert(node1.runCommandUntilNoError("pgrep netplugin"), IsNil)
time.Sleep(20 * time.Second)

// Verify cA1 can ping cA2
c.Assert(cA1.checkPingWithCount(cA2.eth0.ip, 3), IsNil)
// Verify cB1 can ping cB2
c.Assert(cB1.checkPingWithCount(cB2.eth0.ip, 3), IsNil)
// Verify cA1 cannot ping cB1
c.Assert(cA1.checkPingFailureWithCount(cB1.eth0.ip, 5), IsNil)

c.Assert(s.removeContainers([]*container{cA1, cA2, cB1, cB2}), IsNil)
c.Assert(s.cli.EndpointGroupDelete("default", "epgA"), IsNil)
c.Assert(s.cli.EndpointGroupDelete("default", "epgB"), IsNil)
Expand Down

0 comments on commit 6e0d485

Please sign in to comment.