aboutsummaryrefslogtreecommitdiffstats
path: root/sfc/tests
diff options
context:
space:
mode:
Diffstat (limited to 'sfc/tests')
-rw-r--r--sfc/tests/functest/config.yaml6
-rw-r--r--sfc/tests/functest/sfc_parent_function.py124
-rw-r--r--sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py24
3 files changed, 134 insertions, 20 deletions
diff --git a/sfc/tests/functest/config.yaml b/sfc/tests/functest/config.yaml
index d595f0c..021b4c3 100644
--- a/sfc/tests/functest/config.yaml
+++ b/sfc/tests/functest/config.yaml
@@ -60,7 +60,7 @@ testcases:
sfc_two_chains_SSH_and_HTTP:
class_name: "SfcTwoChainsSSHandHTTP"
- enabled: false
+ enabled: true
order: 1
description: "ODL-SFC tests with two chains and one SF per chain"
net_name: example-net
@@ -84,7 +84,7 @@ testcases:
sfc_symmetric_chain:
class_name: "SfcSymmetricChain"
- enabled: false
+ enabled: true
order: 2
description: "Verify the behavior of a symmetric service chain"
net_name: example-net
@@ -106,7 +106,7 @@ testcases:
sfc_chain_deletion:
class_name: "SfcChainDeletion"
- enabled: false
+ enabled: true
order: 3
description: "Verify if chains work correctly after deleting one"
net_name: example-net
diff --git a/sfc/tests/functest/sfc_parent_function.py b/sfc/tests/functest/sfc_parent_function.py
index 9558eb8..40d5d1a 100644
--- a/sfc/tests/functest/sfc_parent_function.py
+++ b/sfc/tests/functest/sfc_parent_function.py
@@ -154,6 +154,7 @@ class SfcCommonTestCase(object):
self.creators = openstack_sfc.creators
self.odl_ip, self.odl_port = odl_utils.get_odl_ip_port(openstack_nodes)
+ odl_utils.get_odl_username_password()
self.default_param_file = os.path.join(
COMMON_CONFIG.sfc_test_dir,
@@ -267,6 +268,9 @@ class SfcCommonTestCase(object):
port_security=False)
self.vnf_objects[vnf_name] = [vnf_instance, vnf_port]
+ logger.info("Creating VNF with name...%s", vnf_name)
+ logger.info("Port associated with VNF...%s",
+ self.vnf_objects[vnf_name][1])
def assign_floating_ip_client_server(self):
"""Assign floating IPs on the router about server and the client
@@ -403,14 +407,43 @@ class SfcCommonTestCase(object):
openstack_sfc.delete_chain()
openstack_sfc.delete_port_groups()
+ def create_classifier(self, fc_name, port=85,
+ protocol='tcp', symmetric=False):
+ """Create the classifier component following the instructions from
+ relevant templates.
+
+ :param fc_name: The name of the classifier
+ :param port: Input port number
+ :param protocol: Input protocol
+ :param symmetric: Check symmetric
+ :return: Create the classifier component
+ """
+
+ logger.info("Creating the classifier...")
+
+ self.neutron_port = self.port_client
+ if COMMON_CONFIG.mano_component == 'no-mano':
+ openstack_sfc.create_classifier(self.neutron_port.id,
+ port,
+ protocol,
+ fc_name,
+ symmetric)
+
+ elif COMMON_CONFIG.mano_component == 'tacker':
+ logger.info("Creating classifier with tacker is not supported")
+
def create_vnffg(self, testcase_config_name, vnffgd_name, vnffg_name,
- port=80, protocol='tcp', symmetric=False):
+ port=80, protocol='tcp', symmetric=False, vnf_index=-1):
"""Create the vnffg components following the instructions from
relevant templates.
:param testcase_config_name: The config input of the test case
:param vnffgd_name: The name of the vnffgd template
:param vnffg_name: The name for the vnffg
+ :param port: Input port number
+ :param protocol: Input protocol
+ :param symmetric: Check symmetric
+ :param vnf_index: Index to specify vnf
:return: Create the vnffg component
"""
@@ -448,9 +481,29 @@ class SfcCommonTestCase(object):
self.neutron_port.id)
elif COMMON_CONFIG.mano_component == 'no-mano':
+ logger.info("Creating the vnffg without any mano component...")
port_groups = []
- for vnf in self.vnfs:
- # vnf_instance is in [0] and vnf_port in [1]
+ if vnf_index == -1:
+ for vnf in self.vnfs:
+ # vnf_instance is in [0] and vnf_port in [1]
+ vnf_instance = self.vnf_objects[vnf][0]
+ vnf_port = self.vnf_objects[vnf][1]
+ if symmetric:
+ # VNFs have two ports
+ neutron_port1 = vnf_port[0]
+ neutron_port2 = vnf_port[1]
+ neutron_ports = [neutron_port1, neutron_port2]
+ else:
+ neutron_port1 = vnf_port[0]
+ neutron_ports = [neutron_port1]
+
+ port_group = \
+ openstack_sfc.create_port_groups(neutron_ports,
+ vnf_instance)
+ port_groups.append(port_group)
+
+ else:
+ vnf = self.vnfs[vnf_index]
vnf_instance = self.vnf_objects[vnf][0]
vnf_port = self.vnf_objects[vnf][1]
if symmetric:
@@ -462,10 +515,9 @@ class SfcCommonTestCase(object):
neutron_port1 = vnf_port[0]
neutron_ports = [neutron_port1]
- port_group = \
- openstack_sfc.create_port_groups(neutron_ports,
- vnf_instance)
- port_groups.append(port_group)
+ port_group = openstack_sfc.create_port_groups(
+ neutron_ports, vnf_instance)
+ port_groups.append(port_group)
self.neutron_port = self.port_client
@@ -486,6 +538,64 @@ class SfcCommonTestCase(object):
port, protocol, vnffg_name,
symmetric)
+ def update_vnffg(self, testcase_config_name, vnffgd_name, vnffg_name,
+ port=80, protocol='tcp', symmetric=False,
+ vnf_index=0, fc_name='red'):
+ """Update the vnffg components following the instructions from
+ relevant templates.
+
+ :param testcase_config_name: The config input of the test case
+ :param vnffgd_name: The name of the vnffgd template
+ :param vnffg_name: The name for the vnffg
+ :param port: To input port number
+ :param protocol: To input protocol
+ :param symmetric: To check symmetric
+ :param vnf_index: Index to identify vnf
+ :param fc_name: The name of the flow classifier
+ :return: Update the vnffg component
+ """
+
+ logger.info("Update the vnffg...")
+
+ if COMMON_CONFIG.mano_component == 'no-mano':
+ port_groups = []
+ for vnf in self.vnfs:
+ # vnf_instance is in [0] and vnf_port in [1]
+ vnf_instance = self.vnf_objects[vnf][0]
+ vnf_port = self.vnf_objects[vnf][1]
+ if symmetric:
+ # VNFs have two ports
+ neutron_port1 = vnf_port[0]
+ neutron_port2 = vnf_port[1]
+ neutron_ports = [neutron_port1, neutron_port2]
+ else:
+ neutron_port1 = vnf_port[0]
+ neutron_ports = [neutron_port1]
+
+ port_group = \
+ openstack_sfc.create_port_groups(neutron_ports,
+ vnf_instance)
+ port_groups.append(port_group)
+
+ openstack_sfc.update_chain(vnffg_name, fc_name, symmetric)
+
+ elif COMMON_CONFIG.mano_component == 'tacker':
+ logger.info("update for tacker is not supported")
+
+ def swap_classifiers(self, vnffg_1_name, vnffg_2_name, symmetric=False):
+ """Interchange classifiers between port chains
+
+ :param vnffg_1_name: Reference to port_chain_1
+ :param vnffg_2_name: Reference to port_chain_2
+ :param symmetric: To check symmetric
+ :return: Interchange the classifiers
+ """
+
+ if COMMON_CONFIG.mano_component == 'no-mano':
+ openstack_sfc.swap_classifiers(vnffg_1_name,
+ vnffg_2_name,
+ symmetric=False)
+
def present_results_http(self):
"""Check whether the connection between server and client using
HTTP protocol is blocked or not.
diff --git a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
index 0cfbea2..92c2711 100644
--- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
+++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
@@ -40,8 +40,15 @@ class SfcTwoChainsSSHandHTTP(sfc_parent_function.SfcCommonTestCase):
self.create_vnf(self.vnfs[0], 'test-vnfd1', 'test-vim')
self.create_vnf(self.vnfs[1], 'test-vnfd2', 'test-vim')
+ logger.info("Call Parent create_vnffg with index")
self.create_vnffg(self.testcase_config.test_vnffgd_red, 'red',
- 'red_http', port=80, protocol='tcp', symmetric=False)
+ 'red_http', port=80, protocol='tcp',
+ symmetric=False, vnf_index=0)
+
+ self.create_vnffg(self.testcase_config.test_vnffgd_blue, 'blue',
+ 'blue_ssh', port=22, protocol='tcp',
+ symmetric=False, vnf_index=1)
+ self.create_classifier('dummy')
t1 = threading.Thread(target=odl_utils.wait_for_classification_rules,
args=(self.ovs_logger, self.compute_nodes,
@@ -60,21 +67,18 @@ class SfcTwoChainsSSHandHTTP(sfc_parent_function.SfcCommonTestCase):
self.check_floating_ips()
self.start_services_in_vm()
- self.vxlan_blocking_start(self.fips_sfs[0], "22")
- self.vxlan_blocking_start(self.fips_sfs[1], "80")
+ self.vxlan_blocking_start(self.fips_sfs[0], "80")
+ self.vxlan_blocking_start(self.fips_sfs[1], "22")
logger.info("Wait for ODL to update the classification rules in OVS")
t1.join()
results = self.present_results_ssh()
- results = self.present_results_allowed_http()
+ results = self.present_results_http()
logger.info("Changing the classification")
- self.remove_vnffg('red_http', 'red')
-
- self.create_vnffg(self.testcase_config.test_vnffgd_blue, 'blue',
- 'blue_ssh')
+ self.swap_classifiers('red_http', 'blue_ssh')
# Start measuring the time it takes to implement the classification
# rules
@@ -82,7 +86,7 @@ class SfcTwoChainsSSHandHTTP(sfc_parent_function.SfcCommonTestCase):
args=(self.ovs_logger, self.compute_nodes,
self.odl_ip, self.odl_port,
self.client_instance.hypervisor_hostname,
- self.neutron_port,))
+ [self.neutron_port],))
try:
t2.start()
except Exception as e:
@@ -91,7 +95,7 @@ class SfcTwoChainsSSHandHTTP(sfc_parent_function.SfcCommonTestCase):
logger.info("Wait for ODL to update the classification rules in OVS")
t2.join()
- results = self.present_results_http()
+ results = self.present_results_allowed_http()
results = self.present_results_allowed_ssh()
if __name__ == '__main__':