Add 'symmetrical' as property of a forwarding path
When Network Service (NS) is supported in Tacker, we can launch multiple VNFFGs by initiating NS. Because each VNFFG can have different 'symmetrical' value, we should support dynamic 'symmetrical' parameter for each VNFFG in VNFFG descriptor. This feature will add 'symmetrical' as a property of forwarding path, so users can set 'symmetrical' value to 'true' or 'false' to change symmetrical value of a port chain in networking-sfc. Change-Id: Ie9a6abe96141954e95902cd426abafa10d744236
This commit is contained in:
parent
210d8f93bb
commit
df8be52ac7
@ -12,11 +12,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
echo "Deleting network service NS1"
|
||||
network_service_id=$(openstack ns list | grep NS1 | awk '{print $2}')
|
||||
if [ -n "$network_service_id" ]; then
|
||||
openstack ns delete $network_service_id
|
||||
fi
|
||||
echo "Deleting network service NS1, NS2"
|
||||
for ns in NS1 NS2; do
|
||||
network_service_id=$(openstack ns list | grep $ns | awk '{print $2}')
|
||||
if [ -n "$network_service_id" ]; then
|
||||
openstack ns delete $network_service_id
|
||||
fi
|
||||
done
|
||||
|
||||
sleep 5
|
||||
|
||||
|
@ -31,6 +31,7 @@ sleep 15
|
||||
client_ip=$(openstack server list | grep http_client | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
|
||||
network_source_port_id=$(openstack port list | grep $client_ip | awk '{print $2}')
|
||||
ip_dst=$(openstack server list | grep http_server | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
|
||||
network_dest_port_id=$(openstack port list | grep $ip_dst | awk '{print $2}')
|
||||
|
||||
echo "Creating/ Updating ns_param.yaml file"
|
||||
cat > ../../samples/tosca-templates/vnffg-nsd/ns_param.yaml << EOL
|
||||
@ -39,6 +40,7 @@ nsd:
|
||||
vl2_name: net0
|
||||
net_src_port_id: ${network_source_port_id}
|
||||
ip_dest_prefix: ${ip_dst}/24
|
||||
net_dst_port_id: ${network_dest_port_id}
|
||||
EOL
|
||||
|
||||
vim_default=$(openstack vim list | grep openstack | awk '{print $10}')
|
||||
|
@ -326,6 +326,7 @@ VNFFG.
|
||||
description: creates path inside ns (src_port->CP12->CP22->dst_port)
|
||||
properties:
|
||||
id: 51
|
||||
symmetrical: true
|
||||
policy:
|
||||
type: ACL
|
||||
criteria:
|
||||
@ -346,6 +347,7 @@ VNFFG.
|
||||
description: creates path inside ns (src_port->CP12->CP22->dst_port)
|
||||
properties:
|
||||
id: 52
|
||||
symmetrical: false
|
||||
policy:
|
||||
type: ACL
|
||||
criteria:
|
||||
|
@ -123,14 +123,32 @@ without "symmetrical", you can ommit "network_dst_port_id" and "ip_dst_prefix".
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
policy:
|
||||
type: ACL
|
||||
criteria:
|
||||
- network_src_port_id: 640dfd77-c92b-45a3-b8fc-22712de480e1
|
||||
network_dst_port_id: ea206bba-7083-4364-a9f1-c0b7fdf61b6e
|
||||
destination_port_range: 80-1024
|
||||
ip_proto: 6
|
||||
ip_dst_prefix: 192.168.1.2/24
|
||||
Forwarding_path1:
|
||||
type: tosca.nodes.nfv.FP.TackerV2
|
||||
description: creates path (CP12->CP22)
|
||||
properties:
|
||||
id: 51
|
||||
symmetrical: true
|
||||
policy:
|
||||
type: ACL
|
||||
criteria:
|
||||
- name: block_tcp
|
||||
classifier:
|
||||
network_src_port_id: 640dfd77-c92b-45a3-b8fc-22712de480e1
|
||||
network_dst_port_id: ea206bba-7083-4364-a9f1-c0b7fdf61b6e
|
||||
ip_dst_prefix: 192.168.1.2/24
|
||||
destination_port_range: 80-1024
|
||||
ip_proto: 6
|
||||
path:
|
||||
- forwarder: VNFD1
|
||||
capability: CP12
|
||||
- forwarder: VNFD2
|
||||
capability: CP22
|
||||
|
||||
In above template, users can set **symmetrical** in properties of a forwarding
|
||||
path create symmetrical VNFFG. If this property is not set, **symmetrical**
|
||||
will be specified by **--symmetrical** in create VNFFG command (default value
|
||||
is False).
|
||||
|
||||
You can use the sample VNFFGD template for symmetrical feature (in port chain)
|
||||
such as this `link <https://github.com/openstack/tacker/tree/master/samples/
|
||||
@ -196,7 +214,7 @@ Here,
|
||||
* param-file - Parameter file in Yaml.
|
||||
* vnf-mapping - Allows a list of logical VNFD to VNF instance mapping
|
||||
* symmetrical - If --symmetrical is present, symmetrical is True
|
||||
(default: False)
|
||||
(default: False - The **symmectical** is set in template has higher priority)
|
||||
|
||||
VNF Mapping is used to declare which exact VNF instance to be used for
|
||||
each VNF in the Forwarding Path. The following command would list VNFs
|
||||
@ -281,12 +299,12 @@ Using the below command query the list of existing VNFFG templates.
|
||||
|
||||
openstack vnf graph list
|
||||
|
||||
+--------------------+--------+------- +-------------------------------------+
|
||||
| ID | Name | Status | VNFFGD ID |
|
||||
+--------------------+-----------------+-------------------------------------+
|
||||
| f4438511-e33d-43df-| | | |
|
||||
| 95d9-0199253db72e | myvnffg| ACTIVE | bd7829bf-85de-4f3b-960a-8482028bfb34|
|
||||
+--------------------+---------+-------+-------------+--------+--------------+
|
||||
+--------------------+---------+--------+-------------------------------------+
|
||||
| ID | Name | Status | VNFFGD ID |
|
||||
+--------------------+------------------+-------------------------------------+
|
||||
| f4438511-e33d-43df-| | | |
|
||||
| 95d9-0199253db72e | myvnffg | ACTIVE | bd7829bf-85de-4f3b-960a-8482028bfb34|
|
||||
+--------------------+---------+--------+-------------+--------+--------------+
|
||||
|
||||
|
||||
After the user located the VNFFG the subsequent action is to update it.
|
||||
@ -341,6 +359,7 @@ derived from the following VNFFGD template.
|
||||
description: creates path (CP1)
|
||||
properties:
|
||||
id: 51
|
||||
symmetrical: false
|
||||
policy:
|
||||
type: ACL
|
||||
criteria:
|
||||
@ -382,6 +401,7 @@ By using the below VNFFGD template we can update the exisitng VNFFG.
|
||||
description: creates path (CP1->CP2)
|
||||
properties:
|
||||
id: 52
|
||||
symmetrical: false
|
||||
policy:
|
||||
type: ACL
|
||||
criteria:
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
This feature adds 'symmetrical' as a property of forwarding path,
|
||||
so users can set 'symmetrical' value to 'true' or 'false' to change
|
||||
the symmetrical value of a port chain in networking-sfc.
|
@ -1,5 +1,6 @@
|
||||
nsd:
|
||||
vl1_name: net_mgmt
|
||||
vl2_name: net0
|
||||
net_src_port_id: 22566484-6585-483b-9f70-0c2811895f96
|
||||
ip_dest_prefix: 10.10.0.11/24
|
||||
net_src_port_id: 5610a59a-68d3-431b-aa11-843744e81041
|
||||
ip_dest_prefix: 10.10.0.5/24
|
||||
net_dst_port_id: 0eed8399-6c51-4eee-b037-0999c93ac898
|
||||
|
@ -48,12 +48,14 @@ topology_template:
|
||||
description: creates path inside ns (src_port->CP12->CP22->dst_port)
|
||||
properties:
|
||||
id: 51
|
||||
symmetrical: true
|
||||
policy:
|
||||
type: ACL
|
||||
criteria:
|
||||
- name: block_tcp
|
||||
classifier:
|
||||
network_src_port_id: {get_input: net_src_port_id}
|
||||
network_dst_port_id: {get_input: net_dst_port_id}
|
||||
destination_port_range: 80-1024
|
||||
ip_proto: 6
|
||||
ip_dst_prefix: {get_input: ip_dest_prefix}
|
||||
@ -68,6 +70,7 @@ topology_template:
|
||||
description: creates path inside ns (src_port->CP12->dst_port)
|
||||
properties:
|
||||
id: 52
|
||||
symmetrical: false
|
||||
policy:
|
||||
type: ACL
|
||||
criteria:
|
||||
|
@ -18,6 +18,9 @@ topology_template:
|
||||
net_src_port_id:
|
||||
type: string
|
||||
description: neutron port id of source port
|
||||
net_dst_port_id:
|
||||
type: string
|
||||
description: neutron port id of destination port
|
||||
ip_dest_prefix:
|
||||
type: string
|
||||
description: IP prefix of destination port
|
||||
@ -48,12 +51,14 @@ topology_template:
|
||||
description: creates path inside ns (src_port->CP12->CP22->dst_port)
|
||||
properties:
|
||||
id: 51
|
||||
symmetrical: true
|
||||
policy:
|
||||
type: ACL
|
||||
criteria:
|
||||
- name: block_tcp
|
||||
classifier:
|
||||
network_src_port_id: {get_input: net_src_port_id}
|
||||
network_dst_port_id: {get_input: net_dst_port_id}
|
||||
destination_port_range: 80-1024
|
||||
ip_proto: 6
|
||||
ip_dst_prefix: {get_input: ip_dest_prefix}
|
||||
@ -64,7 +69,6 @@ topology_template:
|
||||
capability: CP22
|
||||
|
||||
groups:
|
||||
|
||||
VNFFG1:
|
||||
type: tosca.groups.nfv.VNFFG
|
||||
description: HTTP to Corporate Net
|
||||
|
@ -11,6 +11,7 @@ topology_template:
|
||||
description: creates path (CP12->CP22)
|
||||
properties:
|
||||
id: 51
|
||||
symmetrical: true
|
||||
policy:
|
||||
type: ACL
|
||||
criteria:
|
||||
|
@ -11,6 +11,7 @@ topology_template:
|
||||
description: creates path (CP12->CP22)
|
||||
properties:
|
||||
id: 51
|
||||
symmetrical: true
|
||||
policy:
|
||||
type: ACL
|
||||
criteria:
|
||||
|
@ -1,6 +1,3 @@
|
||||
{
|
||||
net_src_port_id: 640dfd77-c92b-45a3-b8fc-22712de480e1
|
||||
dst_port_range: 80-1024
|
||||
ip_dst_pre:
|
||||
- 192.168.1.2/24
|
||||
}
|
||||
net_src_port_id: 640dfd77-c92b-45a3-b8fc-22712de480e1
|
||||
dst_port_range: 80-1024
|
||||
ip_dst_pre: 192.168.1.2/24
|
||||
|
@ -358,7 +358,9 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
|
||||
vnffg_id = vnffg.get('id') or uuidutils.generate_uuid()
|
||||
template_id = vnffg['vnffgd_id']
|
||||
ns_id = vnffg.get('ns_id', None)
|
||||
symmetrical = vnffg['symmetrical']
|
||||
symmetrical_in_temp = self._get_symmetrical_template(context, vnffg)
|
||||
symmetrical = symmetrical_in_temp if symmetrical_in_temp is not None \
|
||||
else vnffg.get('symmetrical')
|
||||
|
||||
with context.session.begin(subtransactions=True):
|
||||
template_db = self._get_resource(context, VnffgTemplate,
|
||||
@ -1336,6 +1338,19 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
|
||||
if template_db.get('template_source') == 'inline':
|
||||
self.delete_vnffgd(context, vnffgd_id)
|
||||
|
||||
def _get_symmetrical_template(self, context, vnffg):
|
||||
vnffgd_topo = None
|
||||
if vnffg.get('vnffgd_template'):
|
||||
vnffgd_topo = vnffg['vnffgd_template']['topology_template']
|
||||
elif vnffg.get('vnffgd_id'):
|
||||
vnffgd_template = self.get_vnffgd(context, vnffg.get('vnffgd_id'))
|
||||
vnffgd_topo = vnffgd_template['template']['vnffgd'][
|
||||
'topology_template']
|
||||
vnffg_name = list(vnffgd_topo['groups'].keys())[0]
|
||||
nfp_name = vnffgd_topo['groups'][vnffg_name]['members'][0]
|
||||
fp_prop = vnffgd_topo['node_templates'][nfp_name]['properties']
|
||||
return fp_prop.get('symmetrical', None)
|
||||
|
||||
def _make_template_dict(self, template, fields=None):
|
||||
res = {}
|
||||
key_list = ('id', 'tenant_id', 'name', 'description', 'template',
|
||||
|
@ -256,10 +256,11 @@ def get_dummy_vnffg_param_obj():
|
||||
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
|
||||
'name': 'dummy_vnffg',
|
||||
u'attributes': {
|
||||
u'template': vnffgd_tosca_param_template},
|
||||
u'template': vnffgd_tosca_param_template,
|
||||
u'param_values':
|
||||
yaml.safe_load(vnffg_params)
|
||||
},
|
||||
'vnf_mapping': {},
|
||||
u'attributes': {u'param_values':
|
||||
yaml.safe_load(vnffg_params)},
|
||||
'symmetrical': False}}
|
||||
|
||||
|
||||
@ -269,10 +270,9 @@ def get_dummy_vnffg_str_param_obj():
|
||||
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
|
||||
'name': 'dummy_vnffg',
|
||||
u'attributes': {
|
||||
u'template': vnffgd_tosca_param_template},
|
||||
'vnf_mapping': {},
|
||||
u'attributes': {
|
||||
u'template': vnffgd_tosca_param_template,
|
||||
u'param_values': 'value not dict format'},
|
||||
'vnf_mapping': {},
|
||||
'symmetrical': False}}
|
||||
|
||||
|
||||
@ -282,10 +282,11 @@ def get_dummy_vnffg_multi_param_obj():
|
||||
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
|
||||
'name': 'dummy_vnffg',
|
||||
u'attributes': {
|
||||
u'template': vnffgd_tosca_multi_param_template},
|
||||
u'template': vnffgd_tosca_multi_param_template,
|
||||
u'param_values':
|
||||
yaml.safe_load(vnffg_multi_params)
|
||||
},
|
||||
'vnf_mapping': {},
|
||||
u'attributes': {u'param_values':
|
||||
yaml.safe_load(vnffg_multi_params)},
|
||||
'symmetrical': False}}
|
||||
|
||||
|
||||
|
@ -81,10 +81,6 @@ def get_by_name():
|
||||
return False
|
||||
|
||||
|
||||
def get_by_id():
|
||||
return False
|
||||
|
||||
|
||||
def dummy_get_vim_auth(*args, **kwargs):
|
||||
return {'vim_auth': {u'username': u'admin', 'password': 'devstack',
|
||||
u'project_name': u'nfv', u'user_id': u'',
|
||||
@ -757,12 +753,11 @@ class TestNfvoPlugin(db_base.SqlTestCase):
|
||||
symmetrical=mock.ANY
|
||||
)
|
||||
|
||||
@mock.patch.object(nfvo_plugin.NfvoPlugin, '_get_by_id')
|
||||
def test_create_vnffg_param_value_format_error(self, mock_get_by_id):
|
||||
def test_create_vnffg_param_value_format_error(self):
|
||||
with patch.object(TackerManager, 'get_service_plugins') as \
|
||||
mock_plugins:
|
||||
mock_plugins.return_value = {'VNFM': FakeVNFMPlugin()}
|
||||
mock_get_by_id.value = get_by_id()
|
||||
self._insert_dummy_vnffg_param_template()
|
||||
vnffg_obj = utils.get_dummy_vnffg_str_param_obj()
|
||||
self.assertRaises(nfvo.VnffgParamValueFormatError,
|
||||
self.nfvo_plugin.create_vnffg,
|
||||
|
@ -305,6 +305,9 @@ node_types:
|
||||
id:
|
||||
type: integer
|
||||
required: false
|
||||
symmetrical:
|
||||
type: boolean
|
||||
required: false
|
||||
policy:
|
||||
type: tosca.nfv.datatypes.policyTypeV2
|
||||
required: false
|
||||
@ -321,6 +324,9 @@ node_types:
|
||||
id:
|
||||
type: integer
|
||||
required: false
|
||||
symmetrical:
|
||||
type: boolean
|
||||
required: false
|
||||
policy:
|
||||
type: tosca.nfv.datatypes.policyType
|
||||
required: true
|
||||
|
Loading…
Reference in New Issue
Block a user