update version of lcm
[vfc/nfvo/lcm.git] / lcm / ns_sfcs / tests / test_sfc_instance.py
1 # Copyright 2018 ZTE Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 # import json
15 # from rest_framework import status
16 # from test_data import nsd_model
17 from django.test import Client
18 from django.test import TestCase
19 from lcm.pub.database.models import FPInstModel, VNFFGInstModel
20
21
22 class TestSfc(TestCase):
23     def setUp(self):
24         self.client = Client()
25         VNFFGInstModel.objects.all().delete()
26         FPInstModel.objects.all().delete()
27         VNFFGInstModel(vnffgdid="vnffg_id1", vnffginstid="vnffg_inst_1", nsinstid="ns_inst_1", endpointnumber=2,
28                        vllist="vlinst1", cplist="cp1", vnflist="vnf1,vnf2").save()
29
30     def tearDown(self):
31         VNFFGInstModel.objects.all().delete()
32         FPInstModel.objects.all().delete()
33
34     # def test_sfc_instance_success(self):
35     #    data = {
36     #        "nsInstanceId": "ns_inst_1",
37     #        "context": json.dumps(nsd_model),
38     #        "fpindex": "fpd_1",
39     #        "sdnControllerId": "sdnControllerId_1"
40     #    }
41     #    resp = self.client.post("/api/nslcm/v1/ns/sfc_instance", data, format='json')
42
43     #    self.assertEqual(resp.status_code, status.HTTP_200_OK, resp.data)
44     #    vnffg = VNFFGInstModel.objects.get(vnffginstid="vnffg_inst_1")
45     #    ret = FPInstModel.objects.get(fpinstid=resp.data["fpinstid"])
46     #    self.assertEqual(vnffg.fplist, resp.data["fpinstid"])
47     #    self.assertIsNotNone(ret)