summaryrefslogtreecommitdiffstats
path: root/res/res/resources/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'res/res/resources/tests.py')
-rw-r--r--res/res/resources/tests.py30
1 files changed, 20 insertions, 10 deletions
diff --git a/res/res/resources/tests.py b/res/res/resources/tests.py
index b865ab6..c660e10 100644
--- a/res/res/resources/tests.py
+++ b/res/res/resources/tests.py
@@ -145,11 +145,11 @@ class ResourceTest(TestCase):
def tearDown(self):
pass
-
+
def test_get_vnf(self):
vnf_inst_id = "1"
NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1').save()
- StorageInstModel(storageid='s02', vimid='vim01', resouceid='resource01', insttype=1,\
+ StorageInstModel(storageid='s02', vimid='vim01', resouceid='resource01', insttype=1,
instid=vnf_inst_id, storagetype='desc01', size='ten').save()
response = self.client.get("/api/vnfres/v1/vnfs/%s" % vnf_inst_id)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
@@ -158,7 +158,8 @@ class ResourceTest(TestCase):
def test_get_vnfs(self):
for i in range(1):
NfInstModel(nfinstid='%s' % i, nf_name='VNF%s' % i).save()
- StorageInstModel(storageid='s0%s' % i, vimid='vim0%s' % i, resouceid='resource0%s' % i, insttype=1, instid='%s' % i, storagetype='desc%s' % i, size='ten').save()
+ StorageInstModel(storageid='s0%s' % i, vimid='vim0%s' % i, resouceid='resource0%s' % i,
+ insttype=1, instid='%s' % i, storagetype='desc%s' % i, size='ten').save()
response = self.client.get("/api/vnfres/v1/vnfs")
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
@@ -166,7 +167,10 @@ class ResourceTest(TestCase):
NfInstModel(nfinstid='%s' % '01', nf_name='VFS%s' % '01').save()
nfInst = NfInstModel.objects.get(pk='01')
for i in range(1):
- VmInstModel(vmid='vm%s' % i, vimid='vim%s' % i, resouceid='res%s' % i, instid='%s' % nfInst.nfinstid, insttype=0, vmname='v1', nic_array='nic%s' % i, metadata='meta%s' % i, volume_array='volume%s' % i, server_group='server%s' % i, availability_zone='ava%s' %i, flavor_id='flavor%s' % i, security_groups='sec%s' % i).save()
+ VmInstModel(vmid='vm%s' % i, vimid='vim%s' % i, resouceid='res%s' % i, instid='%s' % nfInst.nfinstid,
+ insttype=0, vmname='v1', nic_array='nic%s' % i, metadata='meta%s' % i,
+ volume_array='volume%s' % i, server_group='server%s' % i, availability_zone='ava%s' % i,
+ flavor_id='flavor%s' % i, security_groups='sec%s' % i).save()
response = self.client.get("/api/vnfres/v1/%s/vms" % nfInst.nfinstid)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.vms_data, response.data)
@@ -175,36 +179,42 @@ class ResourceTest(TestCase):
NfInstModel(nfinstid='%s' % '01', nf_name='VFS%s' % '01').save()
nfInst = NfInstModel.objects.get(pk='01')
for i in range(1):
- FlavourInstModel(flavourid='fla%s' % i, name='fname%s' % i, vcpu='%d' % i, instid='%s' % nfInst.nfinstid, memory='%d' % i, extraspecs='ext%s' % i, vimid='vim%s' % i, resouceid='res%s' % i).save()
+ FlavourInstModel(flavourid='fla%s' % i, name='fname%s' % i, vcpu='%d' % i, instid='%s' % nfInst.nfinstid,
+ memory='%d' % i, extraspecs='ext%s' % i, vimid='vim%s' % i, resouceid='res%s' % i).save()
response = self.client.get("/api/vnfres/v1/%s/flavors" % nfInst.nfinstid)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.flavors_data, response.data)
def test_get_networks(self):
for i in range(1):
- NetworkInstModel(networkid='net%s' % i, name='net_name%s' % i, vimid='vim%s' % i, instid='%s' % self.nf_inst_id,
- resouceid='res%s' % i, insttype='%d' % i).save()
+ NetworkInstModel(networkid='net%s' % i, name='net_name%s' % i, vimid='vim%s' % i,
+ instid='%s' % self.nf_inst_id, resouceid='res%s' % i, insttype='%d' % i).save()
response = self.client.get("/api/vnfres/v1/%s/networks" % self.nf_inst_id)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.networks_data, response.data)
def test_get_subnets(self):
for i in range(1):
- SubNetworkInstModel(subnetworkid="sub%s" % i, vimid='vim%s' % i, resouceid='res%s' % i, networkid='net%s' % i, insttype='%d' % i, instid='%s' % self.nf_inst_id, name='sub_name%s' % i, cidr="cidr%s" % i).save()
+ SubNetworkInstModel(subnetworkid="sub%s" % i, vimid='vim%s' % i, resouceid='res%s' % i,
+ networkid='net%s' % i, insttype='%d' % i, instid='%s' % self.nf_inst_id,
+ name='sub_name%s' % i, cidr="cidr%s" % i).save()
response = self.client.get("/api/vnfres/v1/%s/subnets" % self.nf_inst_id)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.subnets_data, response.data)
def test_get_cps(self):
for i in range(1):
- CPInstModel(cpinstanceid="cp%s" % i, cpdid='cpd%s' % i, cpinstancename='cpinstname%s' % i, vlinstanceid='vlinst%s' % i, ownertype='%d' % i, ownerid='%s' % self.nf_inst_id, relatedtype='%d' % i).save()
+ CPInstModel(cpinstanceid="cp%s" % i, cpdid='cpd%s' % i, cpinstancename='cpinstname%s' % i,
+ vlinstanceid='vlinst%s' % i, ownertype='%d' % i, ownerid='%s' % self.nf_inst_id,
+ relatedtype='%d' % i).save()
response = self.client.get("/api/vnfres/v1/%s/cps" % self.nf_inst_id)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.cps_data, response.data)
def test_get_volumes(self):
for i in range(1):
- StorageInstModel(storageid="st%s" % i, vimid='vim%s' % i, resouceid='res%s' % i, insttype='%d' % i, instid='%s' % self.nf_inst_id, storagetype='stype%s' % i, size='%s' % i).save()
+ StorageInstModel(storageid="st%s" % i, vimid='vim%s' % i, resouceid='res%s' % i, insttype='%d' % i,
+ instid='%s' % self.nf_inst_id, storagetype='stype%s' % i, size='%s' % i).save()
response = self.client.get("/api/vnfres/v1/%s/volumes" % self.nf_inst_id)
self.assertEqual(self.volumes_data, response.data)
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)