more test cases
diff --git a/xos/tosca/tests/networktest.py b/xos/tosca/tests/networktest.py
index 98f3490..fa446f9 100644
--- a/xos/tosca/tests/networktest.py
+++ b/xos/tosca/tests/networktest.py
@@ -7,7 +7,8 @@
"create_network_maximal",
"create_network_connected",
"create_network_connected_two_slices",
- "update_network_labels"]
+ "update_network_labels",
+ "destroy_network"]
def cleanup(self):
self.try_to_delete(Network, name="test_net")
@@ -111,24 +112,38 @@
assert(net.id == updated_net.id)
-"""
- name = models.CharField(max_length=32)
- template = models.ForeignKey(NetworkTemplate)
- subnet = models.CharField(max_length=32, blank=True)
- ports = models.CharField(max_length=1024, blank=True, null=True, validators=[ValidateNatList])
- labels = models.CharField(max_length=1024, blank=True, null=True)
- owner = models.ForeignKey(Slice, related_name="ownedNetworks", help_text="Slice that owns control of this Network")
+ def update_network_ports(self):
+ self.assert_noobj(Network, "test_net")
+ self.execute(self.get_base_templates() +
+ self.make_nodetemplate("test_net", "tosca.nodes.network.Network.XOS",
+ reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
+ ("Private", "tosca.relationships.UsesNetworkTemplate")]))
+ net=self.assert_obj(Network, "test_net", owner=self.slice1, template=self.private, labels=None, ports=None)
- guaranteed_bandwidth = models.IntegerField(default=0)
- permit_all_slices = models.BooleanField(default=False)
- permitted_slices = models.ManyToManyField(Slice, blank=True, related_name="availableNetworks")
- slices = models.ManyToManyField(Slice, blank=True, related_name="networks", through="NetworkSlice")
- slivers = models.ManyToManyField(Sliver, blank=True, related_name="networks", through="NetworkSliver")
+ self.execute(self.get_base_templates() +
+ self.make_nodetemplate("test_net", "tosca.nodes.network.Network.XOS",
+ props={"port": "tcp/2222, udp/3333"},
+ reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
+ ("Private", "tosca.relationships.UsesNetworkTemplate")]))
- topology_parameters = models.TextField(null=True, blank=True)
- controller_url = models.CharField(null=True, blank=True, max_length=1024)
- controller_parameters = models.TextField(null=True, blank=True)
-"""
+ updated_net = self.assert_obj(Network, "test_net", owner=self.slice1, template=self.private, labels=None, ports="tcp/2222, udp/3333")
+
+ assert(net.id == updated_net.id)
+
+ def destroy_network(self):
+ self.assert_noobj(Network, "test_net")
+ self.execute(self.get_base_templates() +
+ self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
+ reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
+ ("Private", "tosca.relationships.UsesNetworkTemplate")]))
+ net=self.assert_obj(Network, "test_net", owner=self.slice1, template=self.private)
+
+ self.destroy(self.get_base_templates() +
+ self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
+ reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
+ ("Private", "tosca.relationships.UsesNetworkTemplate")]))
+
+ self.assert_noobj(Network, "test_net")
if __name__ == "__main__":
NetworkTest()
diff --git a/xos/tosca/tests/servicetest.py b/xos/tosca/tests/servicetest.py
index 59c71c1..276463d 100644
--- a/xos/tosca/tests/servicetest.py
+++ b/xos/tosca/tests/servicetest.py
@@ -8,7 +8,8 @@
"create_service_notenabled",
"create_service_public_key",
"update_service_notpublished",
- "create_service_maximal"]
+ "create_service_maximal",
+ "destroy_service"]
def cleanup(self):
self.try_to_delete(Service, name="test_svc")
@@ -60,6 +61,13 @@
public_key="foobar",
versionNumber="1.2")
+ def destroy_service(self):
+ self.assert_noobj(Service, "test_svc")
+ self.execute(self.make_nodetemplate("test_svc", "tosca.nodes.Service"))
+ self.assert_obj(Service, "test_svc", kind="generic", published=True, enabled=True)
+ self.destroy(self.make_nodetemplate("test_svc", "tosca.nodes.Service"))
+ self.assert_noobj(Service, "test_svc")
+
if __name__ == "__main__":
ServiceTest()