Skip to content

Commit

Permalink
Merge pull request #446 from gaurav-dalvi/aci-network-issue
Browse files Browse the repository at this point in the history
disabling network creation in ACI mode
  • Loading branch information
jojimt committed Jul 13, 2016
2 parents 4ea44d1 + c98f4ae commit f1bb86f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
12 changes: 12 additions & 0 deletions netmaster/master/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ func CreateNetwork(network intent.ConfigNetwork, stateDriver core.StateDriver, t
return nil
}

aci, _ := IsAciConfigured()
if aci {
// Skip docker network creation for ACI fabric mode.
return nil
}

if GetClusterMode() == "docker" {
// Create the network in docker
err = docknet.CreateDockNet(tenantName, network.Name, "", nwCfg)
Expand Down Expand Up @@ -408,6 +414,12 @@ func DeleteNetworkID(stateDriver core.StateDriver, netID string) error {
return err
}

aci, _ := IsAciConfigured()
if aci {
// Skip docker network deletion for ACI fabric mode.
return nil
}

if nwCfg.NwType != "infra" {
// For Infra nw, endpoint delete initiated by netplugin
// Check if there are any active endpoints
Expand Down
9 changes: 9 additions & 0 deletions systemtests/aci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,27 @@ func (s *systemtestSuite) TestACIMode(c *C) {
Encap: "vlan",
}), IsNil)

err := s.nodes[0].checkDockerNetworkCreated("aciNet", false)
c.Assert(err, IsNil)

c.Assert(s.cli.EndpointGroupPost(&client.EndpointGroup{
TenantName: "default",
NetworkName: "aciNet",
GroupName: "epgA",
}), IsNil)

err = s.nodes[0].checkDockerNetworkCreated("epgA", true)
c.Assert(err, IsNil)

c.Assert(s.cli.EndpointGroupPost(&client.EndpointGroup{
TenantName: "default",
NetworkName: "aciNet",
GroupName: "epgB",
}), IsNil)

err = s.nodes[0].checkDockerNetworkCreated("epgB", true)
c.Assert(err, IsNil)

cA1, err := s.nodes[0].runContainer(containerSpec{networkName: "epgA"})
c.Assert(err, IsNil)

Expand Down
25 changes: 25 additions & 0 deletions systemtests/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,31 @@ func (n *node) cleanupDockerNetwork() error {
return n.tbnode.RunCommand("docker network rm $(docker network ls | grep netplugin | awk '{print $2}')")
}

func (n *node) checkDockerNetworkCreated(nwName string, expectedOp bool) error {
logrus.Infof("Checking whether docker network is created or not")
cmd := fmt.Sprintf("docker network ls | grep netplugin | grep %s | awk \"{print \\$2}\"", nwName)
logrus.Infof("Command to be executed is = %s", cmd)
op, err := n.tbnode.RunCommandWithOutput(cmd)

if err == nil {
// if networks are NOT meant to be created. In ACI mode netctl net create should
// not create docker networks
ret := strings.Contains(op, nwName)
if expectedOp == false && ret != true {
logrus.Infof("Network names Input=%s and Output=%s are NOT matching and thats expected", nwName, op)
} else {
// If netwokrs are meant to be created. In ACI Once you create EPG,
// respective docker network should get created.
if ret == true {
logrus.Infof("Network names are matching.")
return nil
}
}
return nil
}
return err
}

func (n *node) cleanupContainers() error {
logrus.Infof("Cleaning up containers on %s", n.Name())
if os.Getenv("ACI_SYS_TEST_MODE") == "ON" {
Expand Down

0 comments on commit f1bb86f

Please sign in to comment.