weizhouapache commented on code in PR #8022:
URL: https://github.com/apache/cloudstack/pull/8022#discussion_r1342360702


##########
test/integration/smoke/test_vnf_templates.py:
##########
@@ -0,0 +1,338 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+""" Smoke tests for VNF templates/appliances
+"""
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.base import (Account,
+                             Domain,
+                             Configurations,
+                             ServiceOffering,
+                             VirtualMachine,
+                             Network,
+                             NetworkOffering,
+                             VnfTemplate,
+                             Zone)
+from marvin.lib.common import get_zone, get_template
+from nose.plugins.attrib import attr
+
+import time
+
+VNF_NICS = [{"deviceid": "0", "name": "WAN", "required": "true", 
"description": "Public WAN"},
+          {"deviceid": "1", "name": "LAN-1", "required": "true", 
"description": "Private LAN-1"}]
+NEW_VNF_NICS = [{"deviceid": "0", "name": "WAN", "required": "true", 
"description": "Public WAN"},
+          {"deviceid": "1", "name": "LAN-1", "required": "true", 
"description": "Private LAN-1"},
+          {"deviceid": "2", "name": "LAN-2", "required": "false", 
"description": "Private LAN-2"}]
+VNF_DETAILS = [{"access_methods": "console,https,http", "username": "root"}]
+NEW_VNF_DETAILS = [{"access_methods": "console,https,http", "username": 
"root", "password": "cloudstack"}]
+
+class TestVnfTemplates(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        testClient = super(TestVnfTemplates, cls).getClsTestClient()
+        cls.apiclient = testClient.getApiClient()
+        cls._cleanup = []
+        cls.services = testClient.getParsedTestDataConfig()
+
+        # Get Zone, Domain and templates
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+        cls.zone = Zone(zone.__dict__)
+        cls.template = get_template(cls.apiclient, cls.zone.id)
+
+        cls.domain = Domain.create(
+            cls.apiclient,
+            cls.services["domain"]
+        )
+        cls.account = Account.create(
+            cls.apiclient,
+            cls.services["account"],
+            admin=True,
+            domainid=cls.domain.id
+        )
+        cls.user = cls.account.user[0]
+        cls.user_apiclient = cls.testClient.getUserApiClient(
+            cls.user.username, cls.domain.name
+        )
+
+        cls.service_offering = ServiceOffering.create(
+            cls.apiclient,
+            cls.services["service_offerings"]["big"]
+        )
+
+        cls._cleanup = [
+            cls.service_offering,
+            cls.domain,
+            cls.account
+        ]
+
+        cls.vnf_template_config = {
+            "name": "pfsense",
+            "displaytext": "pfsense",
+            "format": "QCOW2",
+            "url": cls.template.url,
+            "requireshvm": "True",
+            "ispublic": "True",
+            "isextractable": "True",
+            "hypervisor": cls.hypervisor,
+            "zoneid": cls.zone.id,
+            "ostype": "FreeBSD 12 (64-bit)",
+            "directdownload": False
+        }
+
+        cls.initial_setting = Configurations.list(
+            cls.apiclient,
+            name="vnf.template.appliance.enabled")[0].value
+
+        Configurations.update(cls.apiclient, "vnf.template.appliance.enabled", 
"true")
+
+        cls.vnf_templates = []
+
+    @classmethod
+    def tearDownClass(cls):
+        Configurations.update(cls.apiclient, "vnf.template.appliance.enabled", 
cls.initial_setting)
+        super(TestVnfTemplates, cls).tearDownClass()
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+
+    def tearDown(self):
+        super(TestVnfTemplates, self).tearDown()
+
+    @attr(tags=["advanced"], required_hardware="false")
+    def test_01_register_vnf_template(self):
+        """Test register VNF template
+        """
+        self.vnf_template = VnfTemplate.register(self.user_apiclient,
+                                                 self.vnf_template_config,
+                                                 zoneid=self.zone.id,
+                                                 hypervisor=self.hypervisor,
+                                                 vnfnics=VNF_NICS,
+                                                 vnfdetails=VNF_DETAILS)

Review Comment:
   template will be removed in `test_05_delete_vnf_template`



##########
test/integration/smoke/test_vnf_templates.py:
##########
@@ -0,0 +1,338 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+""" Smoke tests for VNF templates/appliances
+"""
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.base import (Account,
+                             Domain,
+                             Configurations,
+                             ServiceOffering,
+                             VirtualMachine,
+                             Network,
+                             NetworkOffering,
+                             VnfTemplate,
+                             Zone)
+from marvin.lib.common import get_zone, get_template
+from nose.plugins.attrib import attr
+
+import time
+
+VNF_NICS = [{"deviceid": "0", "name": "WAN", "required": "true", 
"description": "Public WAN"},
+          {"deviceid": "1", "name": "LAN-1", "required": "true", 
"description": "Private LAN-1"}]
+NEW_VNF_NICS = [{"deviceid": "0", "name": "WAN", "required": "true", 
"description": "Public WAN"},
+          {"deviceid": "1", "name": "LAN-1", "required": "true", 
"description": "Private LAN-1"},
+          {"deviceid": "2", "name": "LAN-2", "required": "false", 
"description": "Private LAN-2"}]
+VNF_DETAILS = [{"access_methods": "console,https,http", "username": "root"}]
+NEW_VNF_DETAILS = [{"access_methods": "console,https,http", "username": 
"root", "password": "cloudstack"}]
+
+class TestVnfTemplates(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        testClient = super(TestVnfTemplates, cls).getClsTestClient()
+        cls.apiclient = testClient.getApiClient()
+        cls._cleanup = []
+        cls.services = testClient.getParsedTestDataConfig()
+
+        # Get Zone, Domain and templates
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+        cls.zone = Zone(zone.__dict__)
+        cls.template = get_template(cls.apiclient, cls.zone.id)
+
+        cls.domain = Domain.create(
+            cls.apiclient,
+            cls.services["domain"]
+        )
+        cls.account = Account.create(
+            cls.apiclient,
+            cls.services["account"],
+            admin=True,
+            domainid=cls.domain.id
+        )
+        cls.user = cls.account.user[0]
+        cls.user_apiclient = cls.testClient.getUserApiClient(
+            cls.user.username, cls.domain.name
+        )
+
+        cls.service_offering = ServiceOffering.create(
+            cls.apiclient,
+            cls.services["service_offerings"]["big"]
+        )
+
+        cls._cleanup = [
+            cls.service_offering,
+            cls.domain,
+            cls.account
+        ]

Review Comment:
   done, thanks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to