diff options
Diffstat (limited to 'lcm')
-rw-r--r-- | lcm/lcm/nf/biz/instantiate_vnf.py | 4 | ||||
-rw-r--r-- | lcm/lcm/nf/const.py | 121 | ||||
-rw-r--r-- | lcm/lcm/nf/serializers/ext_link_port_data.py | 3 | ||||
-rw-r--r-- | lcm/lcm/nf/serializers/inst_or_teri_vnf_response.py | 24 | ||||
-rw-r--r-- | lcm/lcm/nf/serializers/instantiate_vnf_request.py | 1 | ||||
-rw-r--r-- | lcm/lcm/nf/tests/test_instantiate_vnf.py | 4 | ||||
-rw-r--r-- | lcm/lcm/nf/views/instantiate_vnf_view.py | 4 |
7 files changed, 98 insertions, 63 deletions
diff --git a/lcm/lcm/nf/biz/instantiate_vnf.py b/lcm/lcm/nf/biz/instantiate_vnf.py index f47746db..87d4f40d 100644 --- a/lcm/lcm/nf/biz/instantiate_vnf.py +++ b/lcm/lcm/nf/biz/instantiate_vnf.py @@ -100,7 +100,7 @@ class InstantiateVnf(Thread): if not is_exist: NfvoRegInfoModel.objects.create( nfvoid=self.nf_inst_id, - vnfminstid=ignore_case_get(self.data, "vnfmId"), + # vnfminstid=ignore_case_get(self.data, "vnfmId"), apiurl=self.vim_id) JobUtil.add_job_status(self.job_id, 15, 'Nf instancing pre-check finish') logger.info("Nf instancing pre-check finish") @@ -216,7 +216,7 @@ class InstantiateVnf(Thread): def vnf_inst_failed_handle(self, error_msg): logger.error('VNF instantiation failed, detail message: %s' % error_msg) - NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status='FAILED', lastuptime=now_time()) + NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status='NOT_INSTANTIATED', lastuptime=now_time()) JobUtil.add_job_status(self.job_id, 255, error_msg) def do_notify(self, res_type, ret): diff --git a/lcm/lcm/nf/const.py b/lcm/lcm/nf/const.py index 5f84b4f3..33ba6548 100644 --- a/lcm/lcm/nf/const.py +++ b/lcm/lcm/nf/const.py @@ -25,74 +25,85 @@ RESOURCE_MAP = {'Storage': 'volumn', 'Network': 'network', 'SubNetwork': 'subnet inst_req_data = { "flavourId": "flavour_1", "instantiationLevelId": "instantiationLevel_1", - "vnfmId": "vnfm_1", "extVirtualLinks": [ { - "vlInstanceId": "1", - "vim": { - "vimInfoId": "1", - "vimId": "1", - "interfaceInfo": { - "vimType": "vim", - "apiVersion": "v2", - "protocolType": "http" - }, - "accessInfo": { - "tenant": "tenant_vCPE", - "username": "vCPE", - "password": "vCPE_321" - }, - "interfaceEndpoint": "http://10.43.21.105:80/" - }, - "resourceId": "1246", + "id": "extVirtualLink_1", + "vimConnectionId": "vimConnection_1", + "resourceProviderId": "resourceProvider_1", + "resourceId": "resource_1", "extCps": [ { - "cpdId": "11", - "addresses": [ + "cpdId": "cpd_1", + "cpConfig": [ { - "addressType": "MAC", - "l2AddressData": "00:f3:43:20:a2:a3" - }, - { - "addressType": "IP", - "l3AddressData": { - "iPAddressType": "IPv4", - "iPAddress": "192.168.104.2" - } + "cpInstanceId": "cpInstance_1", + "linkPortId": "linkPort_1", + "cpProtocolData": [ + { + "layerProtocol": "IP_OVER_ETHERNET", + "ipOverEthernet": { + "macAddress": "00:f3:43:20:a2:a3", + "ipAddresses": [ + { + "type": "IPV4", + "fixedAddresses": ["192.168.104.2", ], + "numDynamicAddresses": 0, + "addressRange": None, + "subnetId": "subnet_1", + } + ] + } + } + ] } - ], - "numDynamicAddresses": 0 + ] + } + ], + "extLinkPorts": [ + { + "id": "extLinkPort_1", + "resourceHandle": { + "vimConnectionId": "vimConnection_1", + "resourceProviderId": "resourceProvider_1", + "resourceId": "resource_1", + "vimLevelResourceType": "vimLevelResourceType_1", + } } ] - }, + } + ], + "extManagedVirtualLinks": [ { - "vlInstanceId": '55', - "resourceId": '55_network', - "resourceSubnetId": '55_subnet', - "cpdId": 'cpId1', - "vim": { - "vimId": '55_vimid' - } + "id": 'extManagedVirtualLink_1', + "virtualLinkDescId": 'virtualLinkDesc_1', + "vimConnectionId": 'vimConnection_1', + "resourceProviderId": 'resourceProvider_1', + "resourceId": 'resource_1', + } + ], + "vimConnectionInfo": [ + { + "id": 'vimConnection_1', + "vimId": 'vim_1', + "vimType": 'vim', + "interfaceInfo": { + "apiVersion": "apiVersion_1", + "protocolType": "http" + }, + "accessInfo": { + "tenant": "tenant_vCPE", + "username": "vCPE", + "password": "vCPE_321", + }, + "extra": None, } ], "localizationLanguage": "en_US", "additionalParams": { - "vimId": "vim_1", - "inputs": { - "key1": "test1", - "key2": "test2" - }, - "extVirtualLinks": [ - { - "vlInstanceId": '55', - "resourceId": '55_network', - "resourceSubnetId": '55_subnet', - "cpdId": 'cpId1', - "vim": { - "vimId": '55_vimid' - } - } - ] + # "inputs": { + "key1": "test1", + "key2": "test2" + # } } } diff --git a/lcm/lcm/nf/serializers/ext_link_port_data.py b/lcm/lcm/nf/serializers/ext_link_port_data.py index e134502c..c6dafdd4 100644 --- a/lcm/lcm/nf/serializers/ext_link_port_data.py +++ b/lcm/lcm/nf/serializers/ext_link_port_data.py @@ -26,5 +26,4 @@ class ExtLinkPortDataSerializer(serializers.Serializer): resourceHandle = ResourceHandleSerializer( help_text="Reference to the virtualised resource realizing this link port.", required=True, - allow_null=False, - allow_blank=False) + allow_null=False) diff --git a/lcm/lcm/nf/serializers/inst_or_teri_vnf_response.py b/lcm/lcm/nf/serializers/inst_or_teri_vnf_response.py new file mode 100644 index 00000000..17b9c0db --- /dev/null +++ b/lcm/lcm/nf/serializers/inst_or_teri_vnf_response.py @@ -0,0 +1,24 @@ +# Copyright 2017 ZTE Corporation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from rest_framework import serializers + + +class InstOrTeriVnfResponseSerializer(serializers.Serializer): + jobId = serializers.CharField( + help_text="jobId", + required=True, + max_length=255, + allow_null=True) diff --git a/lcm/lcm/nf/serializers/instantiate_vnf_request.py b/lcm/lcm/nf/serializers/instantiate_vnf_request.py index c5214fcb..2c3547d2 100644 --- a/lcm/lcm/nf/serializers/instantiate_vnf_request.py +++ b/lcm/lcm/nf/serializers/instantiate_vnf_request.py @@ -46,7 +46,6 @@ class InstantiateVnfRequestSerializer(serializers.Serializer): or refer to external / externally-managed virtual links.", many=True, required=False, - max_length=255, allow_null=True) localizationLanguage = serializers.CharField( help_text="Localization language of the VNF to be instantiated. \ diff --git a/lcm/lcm/nf/tests/test_instantiate_vnf.py b/lcm/lcm/nf/tests/test_instantiate_vnf.py index 7cf2646f..e7604990 100644 --- a/lcm/lcm/nf/tests/test_instantiate_vnf.py +++ b/lcm/lcm/nf/tests/test_instantiate_vnf.py @@ -36,7 +36,7 @@ class TestNFInstantiate(TestCase): self.client = APIClient()
self.grant_result = {
"vimid": 'vimid_1',
- "tenant": 'tenantname_1'
+ "tenant": 'tenantname_1',
}
def tearDown(self):
@@ -50,7 +50,7 @@ class TestNFInstantiate(TestCase): @mock.patch.object(InstantiateVnf, 'run')
def test_instantiate_vnf(self, mock_run):
- NfInstModel(nfinstid='12', nf_name='VNF1').save()
+ NfInstModel(nfinstid='12', nf_name='VNF1', status="UN_INSTANTIATED").save()
mock_run.re.return_value = None
response = self.client.post("/api/vnflcm/v1/vnf_instances/12/instantiate", data=inst_req_data, format='json')
self.failUnlessEqual(status.HTTP_202_ACCEPTED, response.status_code)
diff --git a/lcm/lcm/nf/views/instantiate_vnf_view.py b/lcm/lcm/nf/views/instantiate_vnf_view.py index 3e9c334d..fec85d10 100644 --- a/lcm/lcm/nf/views/instantiate_vnf_view.py +++ b/lcm/lcm/nf/views/instantiate_vnf_view.py @@ -21,7 +21,9 @@ from rest_framework import status from rest_framework.response import Response
from rest_framework.views import APIView
-from lcm.nf.serializers.serializers import InstOrTeriVnfResponseSerializer, InstantiateVnfRequestSerializer
+# from lcm.nf.serializers.serializers import InstantiateVnfRequestSerializer, InstOrTeriVnfResponseSerializer
+from lcm.nf.serializers.instantiate_vnf_request import InstantiateVnfRequestSerializer
+from lcm.nf.serializers.inst_or_teri_vnf_response import InstOrTeriVnfResponseSerializer
from lcm.pub.exceptions import NFLCMException
from lcm.pub.utils.jobutil import JobUtil
|