pip install progressbar2
pip install python-novaclient
pip install python-openstackclient
+pip install python-heatclient
pip install netaddr
pip install kubernetes
def insert_customer_service_to_so(vcpecommon):
- logger = logging.getLogger('__name__')
- logger.info('Inserting neutron HEAT template to SO DB and creating a recipe for customer service')
+ logger = logging.getLogger(__name__)
cmds = []
if True:
csar_file = vcpecommon.find_file('rescust', 'csar', 'csar')
"SERVICE_MODEL_UUID) VALUES ('createInstance','1','{0}'," \
"'/mso/async/services/CreateVcpeResCustService',NULL,181,NULL, NOW()," \
"'{1}');".format(parser.svc_model['modelName'], parser.svc_model['modelVersionId']))
+ logger.info(
+ 'Please manually run the following sql command in SO catalogdb database to insert customer service recipe')
logger.info('\n'.join(cmds))
- vcpecommon.execute_cmds_so_db(cmds)
-
- cmds = []
- cmds.append("delete from `heat_template_params` where"
- "`HEAT_TEMPLATE_ARTIFACT_UUID`='efee1d84-b8ec-11e7-abc4-cec278b6b50a';")
- cmds.append("delete from `heat_template` where ARTIFACT_UUID='efee1d84-b8ec-11e7-abc4-cec278b6b50a';")
- network_tempalte_file = vcpecommon.find_file('neutron', 'yaml', 'preload_templates')
- with open(network_tempalte_file, 'r') as fin:
- lines = fin.readlines()
- longtext = '\n'.join(lines)
- cmds.append("INSERT INTO `heat_template`(`ARTIFACT_UUID`, `NAME`, `VERSION`, `BODY`, `TIMEOUT_MINUTES`, " \
- "`DESCRIPTION`, `CREATION_TIMESTAMP`, `ARTIFACT_CHECKSUM`) VALUES(" \
- "'efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'Generic NeutronNet', '1', '{0}', 10, " \
- "'Generic Neutron Template', NOW(), 'MANUAL RECORD');".format(longtext))
-
- cmds.append("INSERT INTO `heat_template_params`(`HEAT_TEMPLATE_ARTIFACT_UUID`, `PARAM_NAME`, `IS_REQUIRED`, " \
- "`PARAM_TYPE`, `PARAM_ALIAS`) VALUES('efee1d84-b8ec-11e7-abc4-cec278b6b50a', 'shared', 0, " \
- "'string', NULL);")
-
- print('\n'.join(cmds))
- vcpecommon.execute_cmds_so_db(cmds)
-
+ #vcpecommon.execute_cmds_so_db(cmds)
+++ /dev/null
-#! /usr/bin/python
-
-import logging
-import json
-from vcpecommon import *
-import commands
-
-
-logging.basicConfig(level=logging.INFO, format='%(message)s')
-common = VcpeCommon()
-
-print('Checking vGMUX REST API from SDNC')
-cmd = 'curl -u admin:admin -X GET http://10.0.101.21:8183/restconf/config/ietf-interfaces:interfaces'
-ret = commands.getstatusoutput("ssh -i onap_dev root@sdnc '{0}'".format(cmd))
-sz = ret[-1].split('\n')[-1]
-print('\n')
-print(sz)
-
-print('Checking vBRG REST API from SDNC')
-cmd = 'curl -u admin:admin -X GET http://10.3.0.2:8183/restconf/config/ietf-interfaces:interfaces'
-ret = commands.getstatusoutput("ssh -i onap_dev root@sdnc '{0}'".format(cmd))
-sz = ret[-1].split('\n')[-1]
-print('\n')
-print(sz)
-
-print('Checking SDNC DB for vBRG MAC address')
-mac = common.get_brg_mac_from_sdnc()
-print(mac)
-
-
class Preload:
def __init__(self, vcpecommon):
self.logger = logging.getLogger(__name__)
+ self.logger.setLevel(logging.DEBUG)
self.vcpecommon = vcpecommon
def replace(self, sz, replace_dict):
--- /dev/null
+{
+ "policy-id": "operational.vcpe",
+ "content": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e%0D%0A++trigger_policy%3A+unique-policy-id-1-restart%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+true%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-restart%0D%0A++++name%3A+Restart+the+VM%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+Restart%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard"
+}
--- /dev/null
+{
+ "policies": [
+ {
+ "policy-id": "operational.vcpe",
+ "policy-version": 1
+ }
+ ]
+}
#! /usr/bin/python
-import sys
+
import logging
+logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(name)s.%(funcName)s(): %(message)s')
+
+import sys
from vcpecommon import *
import sdcutils
import soutils
def deploy_brg_only():
- logging.basicConfig(level=logging.INFO, format='%(message)s')
logger = logging.getLogger(__name__)
vcpecommon = VcpeCommon()
def closed_loop(lossrate=0):
- if lossrate > 0:
- while 'y' != raw_input('Please enter docker container "drools" in Policy VM and type "policy stop". Then enter y here: ').lower():
- continue
nodes = ['brg', 'mux']
logger = logging.getLogger('__name__')
vcpecommon = VcpeCommon(nodes)
time.sleep(2)
vcpecommon.set_vgmux_packet_loss_rate(lossrate, vcpecommon.load_vgmux_vnf_name())
if lossrate > 0:
- print('Please enter docker container "drools" in Policy VM and type "policy start". Then observe vGMUX being restarted.')
+ print('Now please observe vGMUX being restarted')
def init_so_sdnc():
if __name__ == '__main__':
- logging.basicConfig(level=logging.DEBUG, format='%(message)s')
-
print('----------------------------------------------------------------------------------------------------')
print(' vcpe.py: Brief info about this program')
# print(' vcpe.py sdc: Onboard VNFs, design and distribute vCPE services (under development)')
owning_entity_name = 'OE-Demonstration1'
def __init__(self, extra_host_names=None):
- rootlogger = logging.getLogger()
- handler = logging.StreamHandler()
- formatter = logging.Formatter('%(asctime)s %(levelname)s %(name)s.%(funcName)s(): %(message)s')
- handler.setFormatter(formatter)
- rootlogger.addHandler(handler)
- rootlogger.setLevel(logging.INFO)
-
self.logger = logging.getLogger(__name__)
- self.logger.propagate = False
- self.logger.addHandler(handler)
self.logger.setLevel(logging.DEBUG)
self.logger.info('Initializing configuration')