base_url='unix://var/run/docker.sock')
return self.docker_cli
+ def getDockernetContainers(self):
+ """
+ List the containers managed by dockernet
+ """
+ return self.getDockerCli().containers(filters={"label": "com.dockernet"})
+
@staticmethod
def setUp():
pass
# make sure that all pending docker containers are killed
with open(os.devnull, 'w') as devnull:
subprocess.call(
- "sudo docker rm -f $(sudo docker ps -a -q)",
+ "sudo docker rm -f $(sudo docker ps --filter 'label=com.dockernet' -a -q)",
stdout=devnull,
stderr=devnull,
shell=True)
# start Mininet network
self.startNet()
# check number of running nodes
- assert(len(self.getDockerCli().containers()) == 0)
+ assert(len(self.getDockernetContainers()) == 0)
assert(len(self.net.hosts) == 2)
assert(len(self.net.switches) == 1)
# check connectivity by using ping
# start Mininet network
self.startNet()
# check number of running nodes
- assert(len(self.getDockerCli().containers()) == 0)
+ assert(len(self.getDockernetContainers()) == 0)
assert(len(self.net.hosts) == 2)
assert(len(self.net.switches) == 2)
# check connectivity by using ping
# start Mininet network
self.startNet()
# check number of running nodes
- assert(len(self.getDockerCli().containers()) == 0)
+ assert(len(self.getDockernetContainers()) == 0)
assert(len(self.net.hosts) == 2)
assert(len(self.net.switches) == 5)
# check connectivity by using ping
# add compute resources
vnf1 = self.dc[0].startCompute("vnf1")
# check number of running nodes
- assert(len(self.getDockerCli().containers()) == 1)
+ assert(len(self.getDockernetContainers()) == 1)
assert(len(self.net.hosts) == 2)
assert(len(self.net.switches) == 1)
# check compute list result
# add compute resources
vnf1 = self.dc[0].startCompute("vnf1")
# check number of running nodes
- assert(len(self.getDockerCli().containers()) == 1)
+ assert(len(self.getDockernetContainers()) == 1)
assert(len(self.net.hosts) == 2)
assert(len(self.net.switches) == 1)
# check compute list result
# remove compute resources
self.dc[0].stopCompute("vnf1")
# check number of running nodes
- assert(len(self.getDockerCli().containers()) == 0)
+ assert(len(self.getDockernetContainers()) == 0)
assert(len(self.net.hosts) == 1)
assert(len(self.net.switches) == 1)
# check compute list result
# add compute resources
vnf1 = self.dc[0].startCompute("vnf1")
# check number of running nodes
- assert(len(self.getDockerCli().containers()) == 1)
+ assert(len(self.getDockernetContainers()) == 1)
assert(len(self.net.hosts) == 2)
assert(len(self.net.switches) == 1)
# check compute list result
vnf1 = self.dc[0].startCompute("vnf1")
vnf2 = self.dc[1].startCompute("vnf2")
# check number of running nodes
- assert(len(self.getDockerCli().containers()) == 2)
+ assert(len(self.getDockernetContainers()) == 2)
assert(len(self.net.hosts) == 2)
assert(len(self.net.switches) == 5)
# check compute list result
vnf1 = self.dc[0].startCompute("vnf1")
vnf2 = self.dc[1].startCompute("vnf2")
# check number of running nodes
- assert(len(self.getDockerCli().containers()) == 2)
+ assert(len(self.getDockernetContainers()) == 2)
assert(len(self.net.hosts) == 2)
assert(len(self.net.switches) == 5)
# check compute list result
# remove compute resources
self.dc[0].stopCompute("vnf1")
# check number of running nodes
- assert(len(self.getDockerCli().containers()) == 1)
+ assert(len(self.getDockernetContainers()) == 1)
assert(len(self.net.hosts) == 1)
assert(len(self.net.switches) == 5)
# check compute list result