1 from emuvim
.test
.base
import SimpleTestTopology
2 from emuvim
.dcemulator
.resourcemodel
import BaseResourceModel
5 class testResourceModel(SimpleTestTopology
):
7 def testBaseResourceModelApi(self
):
9 # TODO test add flavor etc.
10 # TODO test aaloc / free
12 def testAddRmToDc(self
):
14 self
.createNet(nswitches
=0, ndatacenter
=1, nhosts
=2, ndockers
=0)
16 self
.net
.addLink(self
.dc
[0], self
.h
[0])
17 self
.net
.addLink(self
.h
[1], self
.dc
[0])
19 r
= BaseResourceModel()
20 self
.dc
[0].assignResourceModel(r
)
21 # start Mininet network
23 # check number of running nodes
24 assert(len(self
.getDockernetContainers()) == 0)
25 assert(len(self
.net
.hosts
) == 2)
26 assert(len(self
.net
.switches
) == 1)
27 # check resource model and resource model registrar
28 assert(self
.dc
[0]._resource
_model
is not None)
29 assert(self
.net
.rm_registrar
.num_models
== 1)
30 # TODO test if alloc was called on start
31 # TODO if free was called on stop
32 # check connectivity by using ping
33 assert(self
.net
.ping([self
.h
[0], self
.h
[1]]) <= 0.0)
34 # stop Mininet network