3 Authors: Baohua Yang@IBM, Denghui Huang@IBM
10 from restlib import * # noqa
11 from testmodule import TestModule
16 class ContainerManager(TestModule):
18 Test for the container manager.
19 Start 2-layer tree topology network. e.g., in Mininet, run
20 'sudo mn --controller=remote,ip=127.0.0.1 --mac --topo tree,2'
23 def __init__(self, restSubContext='/controller/nb/v2/containermanager', user=DEFAULT_USER, password=DEFAULT_PWD,
24 container=None, contentType='json', prefix=DEFAULT_PREFIX):
25 super(self.__class__, self).__init__(restSubContext, user, password, container, contentType, prefix)
27 def get_containers(self):
29 The name is suggested to match the NB API.
32 return super(self.__class__, self).get_entries('containers')
34 def add_container(self, name, body):
38 super(self.__class__, self).add_entry('container', name, body)
40 def remove_container(self, name):
44 super(self.__class__, self).remove_entry('container', name)
46 def test_container_operations(self, name, body):
48 Test subnet operations, like adding and removeing a subnet.
49 >>> ContainerManager().test_container_operations('cont1',
50 {'container':'cont1','flowSpecs': [], 'staticVlan':'10','nodeConnectors':[
51 "OF|1@OF|00:00:00:00:00:00:00:01",
52 "OF|23@OF|00:00:00:00:00:00:20:21"]})
55 return super(self.__class__, self).test_add_remove_operations('containers', 'container', name, body,