Bartek Grzybowski | fbbdbec | 2019-09-25 16:37:05 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
Yang Xu | 1b31a1d | 2019-06-26 01:50:15 -0400 | [diff] [blame] | 2 | |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 3 | import logging |
Bartek Grzybowski | fbbdbec | 2019-09-25 16:37:05 +0200 | [diff] [blame] | 4 | logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(name)s.%(funcName)s(): %(message)s') |
Yang Xu | 1b31a1d | 2019-06-26 01:50:15 -0400 | [diff] [blame] | 5 | |
| 6 | import sys |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 7 | from vcpecommon import * |
Yang Xu | c52ed6e | 2019-04-29 00:20:52 -0400 | [diff] [blame] | 8 | import sdcutils |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 9 | import soutils |
| 10 | from datetime import datetime |
| 11 | import preload |
| 12 | import vcpe_custom_service |
| 13 | import csar_parser |
| 14 | import config_sdnc_so |
Kang Xi | 6c76239 | 2018-05-30 09:27:34 -0400 | [diff] [blame] | 15 | import json |
Bartek Grzybowski | decd6fb6 | 2019-10-31 12:49:46 +0100 | [diff] [blame] | 16 | import urllib3 |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 17 | |
Bartek Grzybowski | decd6fb6 | 2019-10-31 12:49:46 +0100 | [diff] [blame] | 18 | # disable InsecureRequestWarning warning in requests < 2.16.0 |
| 19 | urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
| 20 | # disable InsecureRequestWarning warning in requests >= 2.16.0 |
| 21 | from requests.packages.urllib3.exceptions import InsecureRequestWarning |
| 22 | requests.packages.urllib3.disable_warnings(InsecureRequestWarning) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 23 | |
| 24 | def config_sniro(vcpecommon, vgmux_svc_instance_uuid, vbrg_svc_instance_uuid): |
| 25 | logger = logging.getLogger(__name__) |
| 26 | |
| 27 | logger.info('\n----------------------------------------------------------------------------------') |
| 28 | logger.info('Start to config SNIRO homing emulator') |
| 29 | |
| 30 | preloader = preload.Preload(vcpecommon) |
| 31 | template_sniro_data = vcpecommon.find_file('sniro_data', 'json', 'preload_templates') |
| 32 | template_sniro_request = vcpecommon.find_file('sniro_request', 'json', 'preload_templates') |
| 33 | |
| 34 | vcperescust_csar = vcpecommon.find_file('rescust', 'csar', 'csar') |
| 35 | parser = csar_parser.CsarParser() |
| 36 | parser.parse_csar(vcperescust_csar) |
| 37 | tunnelxconn_ar_name = None |
| 38 | brg_ar_name = None |
| 39 | vgw_name = None |
| 40 | for model in parser.vnf_models: |
Yang Xu | 86c0e4a | 2018-12-02 13:10:41 -0500 | [diff] [blame] | 41 | logger.info('modelCustomizationName = %s', model['modelCustomizationName']) |
Yang Xu | 27e1624 | 2018-12-28 01:00:50 -0500 | [diff] [blame] | 42 | if 'tunnel' in model['modelCustomizationName'].lower(): |
Yang Xu | 86c0e4a | 2018-12-02 13:10:41 -0500 | [diff] [blame] | 43 | logger.info('tunnel is in %s', model['modelCustomizationName']) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 44 | tunnelxconn_ar_name = model['modelCustomizationName'] |
Yang Xu | 27e1624 | 2018-12-28 01:00:50 -0500 | [diff] [blame] | 45 | elif 'brg' in model['modelCustomizationName'].lower(): |
Yang Xu | 86c0e4a | 2018-12-02 13:10:41 -0500 | [diff] [blame] | 46 | logger.info('brg is in %s', model['modelCustomizationName']) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 47 | brg_ar_name = model['modelCustomizationName'] |
Yang Xu | 86c0e4a | 2018-12-02 13:10:41 -0500 | [diff] [blame] | 48 | #elif 'vgw' in model['modelCustomizationName']: |
| 49 | else: |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 50 | vgw_name = model['modelCustomizationName'] |
| 51 | |
| 52 | if not (tunnelxconn_ar_name and brg_ar_name and vgw_name): |
| 53 | logger.error('Cannot find all names from %s.', vcperescust_csar) |
Bartek Grzybowski | 68d93c2 | 2019-10-30 10:55:55 +0100 | [diff] [blame] | 54 | sys.exit(1) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 55 | |
| 56 | preloader.preload_sniro(template_sniro_data, template_sniro_request, tunnelxconn_ar_name, vgw_name, brg_ar_name, |
| 57 | vgmux_svc_instance_uuid, vbrg_svc_instance_uuid) |
| 58 | |
| 59 | |
| 60 | def create_one_service(vcpecommon, csar_file, vnf_template_file, preload_dict, suffix, heatbridge=False): |
| 61 | """ |
| 62 | :return: service instance UUID |
| 63 | """ |
| 64 | so = soutils.SoUtils(vcpecommon, 'v4') |
| 65 | return so.create_entire_service(csar_file, vnf_template_file, preload_dict, suffix, heatbridge) |
| 66 | |
Kang Xi | 6c76239 | 2018-05-30 09:27:34 -0400 | [diff] [blame] | 67 | |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 68 | def deploy_brg_only(): |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 69 | logger = logging.getLogger(__name__) |
| 70 | |
| 71 | vcpecommon = VcpeCommon() |
| 72 | preload_dict = vcpecommon.load_preload_data() |
Kang Xi | 6c76239 | 2018-05-30 09:27:34 -0400 | [diff] [blame] | 73 | # name_suffix = preload_dict['${brg_bng_net}'].split('_')[-1] |
| 74 | name_suffix = datetime.now().strftime('%Y%m%d%H%M') |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 75 | |
| 76 | # create multiple services based on the pre-determined order |
| 77 | svc_instance_uuid = vcpecommon.load_object(vcpecommon.svc_instance_uuid_file) |
Bartek Grzybowski | dc3a1e8 | 2019-11-20 15:43:26 +0100 | [diff] [blame] | 78 | for keyword in ['brgemu']: |
| 79 | keyword_vnf=keyword + "_" |
| 80 | keyword_gra=keyword + "gra_" |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 81 | heatbridge = 'gmux' == keyword |
| 82 | csar_file = vcpecommon.find_file(keyword, 'csar', 'csar') |
Bartek Grzybowski | dc3a1e8 | 2019-11-20 15:43:26 +0100 | [diff] [blame] | 83 | vnf_template_file = vcpecommon.find_file(keyword_vnf, 'json', 'preload_templates') |
| 84 | gra_template_file = vcpecommon.find_file(keyword_gra, 'json', 'preload_templates') |
| 85 | if vcpecommon.gra_api_flag: |
| 86 | vcpecommon.increase_ip_address_or_vni_in_template(gra_template_file, ['vbrgemu_private_ip_0']) |
| 87 | svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, gra_template_file, preload_dict, |
| 88 | name_suffix, heatbridge) |
| 89 | else: |
| 90 | vcpecommon.increase_ip_address_or_vni_in_template(vnf_template_file, ['vbrgemu_private_ip_0']) |
| 91 | svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, vnf_template_file, preload_dict, |
| 92 | name_suffix, heatbridge) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 93 | if not svc_instance_uuid[keyword]: |
Bartek Grzybowski | 68d93c2 | 2019-10-30 10:55:55 +0100 | [diff] [blame] | 94 | sys.exit(1) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 95 | |
| 96 | # Setting up SNIRO |
Brian Freeman | 9b3d6ca | 2019-11-06 13:22:53 -0500 | [diff] [blame] | 97 | config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brgemu']) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 98 | |
Kang Xi | 6c76239 | 2018-05-30 09:27:34 -0400 | [diff] [blame] | 99 | |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 100 | def deploy_infra(): |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 101 | logger = logging.getLogger(__name__) |
| 102 | |
| 103 | vcpecommon = VcpeCommon() |
| 104 | |
Brian Freeman | 9b3d6ca | 2019-11-06 13:22:53 -0500 | [diff] [blame] | 105 | # preload all VNF-API networks |
| 106 | network_template = vcpecommon.find_file('network.', 'json', 'preload_templates') |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 107 | name_suffix = datetime.now().strftime('%Y%m%d%H%M') |
| 108 | preloader = preload.Preload(vcpecommon) |
| 109 | preload_dict = preloader.preload_all_networks(network_template, name_suffix) |
| 110 | logger.debug('Initial preload dictionary:') |
| 111 | logger.debug(json.dumps(preload_dict, indent=4, sort_keys=True)) |
| 112 | if not preload_dict: |
| 113 | logger.error("Failed to preload networks.") |
Bartek Grzybowski | 68d93c2 | 2019-10-30 10:55:55 +0100 | [diff] [blame] | 114 | sys.exit(1) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 115 | vcpecommon.save_preload_data(preload_dict) |
| 116 | |
Brian Freeman | 9b3d6ca | 2019-11-06 13:22:53 -0500 | [diff] [blame] | 117 | # preload all GRA-API networks |
| 118 | network_template_gra = vcpecommon.find_file('networkgra.', 'json', 'preload_templates') |
| 119 | preloader = preload.Preload(vcpecommon) |
| 120 | preload_dict_gra = preloader.preload_all_networks(network_template_gra, name_suffix) |
| 121 | logger.debug('Initial preload dictionary:') |
| 122 | logger.debug(json.dumps(preload_dict, indent=4, sort_keys=True)) |
| 123 | if not preload_dict_gra: |
| 124 | logger.error("Failed to preload networks.") |
| 125 | sys.exit(1) |
| 126 | vcpecommon.save_preload_data(preload_dict_gra) |
| 127 | |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 128 | # create multiple services based on the pre-determined order |
| 129 | svc_instance_uuid = {} |
Brian Freeman | 9b3d6ca | 2019-11-06 13:22:53 -0500 | [diff] [blame] | 130 | for keyword in ['infra', 'bng', 'gmux', 'brgemu']: |
| 131 | keyword_vnf=keyword + "_" |
| 132 | keyword_gra=keyword + "gra_" |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 133 | heatbridge = 'gmux' == keyword |
| 134 | csar_file = vcpecommon.find_file(keyword, 'csar', 'csar') |
Brian Freeman | 9b3d6ca | 2019-11-06 13:22:53 -0500 | [diff] [blame] | 135 | vnf_template_file = vcpecommon.find_file(keyword_vnf, 'json', 'preload_templates') |
| 136 | gra_template_file = vcpecommon.find_file(keyword_gra, 'json', 'preload_templates') |
| 137 | if vcpecommon.gra_api_flag: |
| 138 | svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, gra_template_file, preload_dict, |
| 139 | name_suffix, heatbridge) |
| 140 | else: |
| 141 | svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, vnf_template_file, preload_dict, |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 142 | name_suffix, heatbridge) |
| 143 | if not svc_instance_uuid[keyword]: |
Bartek Grzybowski | 68d93c2 | 2019-10-30 10:55:55 +0100 | [diff] [blame] | 144 | sys.exit(1) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 145 | |
| 146 | vcpecommon.save_object(svc_instance_uuid, vcpecommon.svc_instance_uuid_file) |
Brian Freeman | 9b3d6ca | 2019-11-06 13:22:53 -0500 | [diff] [blame] | 147 | |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 148 | # Setting up SNIRO |
Brian Freeman | 9b3d6ca | 2019-11-06 13:22:53 -0500 | [diff] [blame] | 149 | config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brgemu']) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 150 | |
| 151 | print('----------------------------------------------------------------------------------------------------') |
| 152 | print('Congratulations! The following have been completed correctly:') |
| 153 | print(' - Infrastructure Service Instantiation: ') |
| 154 | print(' * 4 VMs: DHCP, AAA, DNS, Web Server') |
| 155 | print(' * 2 Networks: CPE_PUBLIC, CPE_SIGNAL') |
| 156 | print(' - vBNG Service Instantiation: ') |
| 157 | print(' * 1 VM: vBNG') |
| 158 | print(' * 2 Networks: BRG_BNG, BNG_MUX') |
| 159 | print(' - vGMUX Service Instantiation: ') |
| 160 | print(' * 1 VM: vGMUX') |
| 161 | print(' * 1 Network: MUX_GW') |
| 162 | print(' - vBRG Service Instantiation: ') |
| 163 | print(' * 1 VM: vBRG') |
| 164 | print(' - Adding vGMUX vServer information to AAI.') |
| 165 | print(' - SNIRO Homing Emulator configuration.') |
| 166 | |
| 167 | |
| 168 | def deploy_custom_service(): |
| 169 | nodes = ['brg', 'mux'] |
| 170 | vcpecommon = VcpeCommon(nodes) |
| 171 | custom_service = vcpe_custom_service.CustomService(vcpecommon) |
| 172 | |
| 173 | # clean up |
Kang Xi | 0e0a1d6 | 2018-07-23 16:53:54 -0400 | [diff] [blame] | 174 | host_dic = {k: vcpecommon.hosts[k] for k in nodes} |
| 175 | if False: |
| 176 | if not vcpecommon.delete_vxlan_interfaces(host_dic): |
Bartek Grzybowski | 68d93c2 | 2019-10-30 10:55:55 +0100 | [diff] [blame] | 177 | sys.exit(1) |
Kang Xi | 0e0a1d6 | 2018-07-23 16:53:54 -0400 | [diff] [blame] | 178 | custom_service.del_all_vgw_stacks(vcpecommon.vgw_name_keyword) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 179 | |
Kang Xi | 6c76239 | 2018-05-30 09:27:34 -0400 | [diff] [blame] | 180 | #custom_service.clean_up_sdnc() |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 181 | |
| 182 | # create new service |
| 183 | csar_file = vcpecommon.find_file('rescust', 'csar', 'csar') |
| 184 | vgw_template_file = vcpecommon.find_file('vgw', 'json', 'preload_templates') |
Brian Freeman | 81f6e9e | 2018-11-11 22:36:20 -0500 | [diff] [blame] | 185 | vgw_gra_template_file = vcpecommon.find_file('gwgra', 'json', 'preload_templates') |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 186 | preload_dict = vcpecommon.load_preload_data() |
Brian Freeman | 81f6e9e | 2018-11-11 22:36:20 -0500 | [diff] [blame] | 187 | custom_service.create_custom_service(csar_file, vgw_template_file, vgw_gra_template_file, preload_dict) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 188 | |
| 189 | |
| 190 | def closed_loop(lossrate=0): |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 191 | nodes = ['brg', 'mux'] |
| 192 | logger = logging.getLogger('__name__') |
| 193 | vcpecommon = VcpeCommon(nodes) |
Bartek Grzybowski | dbb3ba1 | 2019-09-25 11:21:42 +0200 | [diff] [blame] | 194 | |
| 195 | logger.info('Setting up closed loop policy') |
| 196 | policy_template_file = vcpecommon.find_file('operational.vcpe', 'json', 'preload_templates') |
| 197 | vcpecommon.set_closed_loop_policy(policy_template_file) |
| 198 | |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 199 | logger.info('Cleaning up vGMUX data reporting settings') |
| 200 | vcpecommon.del_vgmux_ves_mode() |
| 201 | time.sleep(2) |
| 202 | vcpecommon.del_vgmux_ves_collector() |
| 203 | |
Yang Xu | 9f935b2 | 2018-11-22 10:56:52 -0500 | [diff] [blame] | 204 | logger.info('Starting vGMUX data reporting to DCAE') |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 205 | time.sleep(2) |
| 206 | vcpecommon.set_vgmux_ves_collector() |
| 207 | |
| 208 | logger.info('Setting vGMUX to report packet loss rate: %s', lossrate) |
| 209 | time.sleep(2) |
| 210 | vcpecommon.set_vgmux_packet_loss_rate(lossrate, vcpecommon.load_vgmux_vnf_name()) |
| 211 | if lossrate > 0: |
Yang Xu | 1b31a1d | 2019-06-26 01:50:15 -0400 | [diff] [blame] | 212 | print('Now please observe vGMUX being restarted') |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 213 | |
| 214 | |
| 215 | def init_so_sdnc(): |
| 216 | logger = logging.getLogger('__name__') |
| 217 | vcpecommon = VcpeCommon() |
Bartek Grzybowski | ba8a72f | 2019-11-22 15:02:21 +0100 | [diff] [blame] | 218 | config_sdnc_so.insert_sdnc_ip_pool(vcpecommon) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 219 | config_sdnc_so.insert_customer_service_to_so(vcpecommon) |
Yang Xu | 63a0afd | 2018-11-20 16:01:01 -0500 | [diff] [blame] | 220 | #config_sdnc_so.insert_customer_service_to_sdnc(vcpecommon) |
Brian Freeman | 8076a87 | 2018-11-13 11:34:48 -0500 | [diff] [blame] | 221 | vgw_vfmod_name_index= 0 |
| 222 | vcpecommon.save_object(vgw_vfmod_name_index, vcpecommon.vgw_vfmod_name_index_file) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 223 | |
Yang Xu | 0e319ef | 2019-04-30 14:28:07 -0400 | [diff] [blame] | 224 | |
| 225 | def init(): |
Yang Xu | c52ed6e | 2019-04-29 00:20:52 -0400 | [diff] [blame] | 226 | vcpecommon = VcpeCommon() |
Yang Xu | 0e319ef | 2019-04-30 14:28:07 -0400 | [diff] [blame] | 227 | init_sdc(vcpecommon) |
| 228 | download_vcpe_service_templates(vcpecommon) |
Bartek Grzybowski | 6358aa3 | 2019-10-30 13:46:43 +0100 | [diff] [blame] | 229 | preloader = preload.Preload(vcpecommon) |
| 230 | template_aai_region_data = vcpecommon.find_file('aai_region_data', 'json', 'preload_templates') |
| 231 | preloader.preload_aai_data(template_aai_region_data) |
Yang Xu | 0e319ef | 2019-04-30 14:28:07 -0400 | [diff] [blame] | 232 | |
| 233 | |
| 234 | def init_sdc(vcpecommon): |
Yang Xu | c52ed6e | 2019-04-29 00:20:52 -0400 | [diff] [blame] | 235 | sdc = sdcutils.SdcUtils(vcpecommon) |
Brian Freeman | e8aa3f0 | 2019-09-20 08:29:22 -0500 | [diff] [blame] | 236 | # default SDC creates BRG - remove this in frankfurt |
| 237 | #sdc.create_allotted_resource_subcategory('BRG') |
Yang Xu | 0e319ef | 2019-04-30 14:28:07 -0400 | [diff] [blame] | 238 | |
| 239 | |
| 240 | def download_vcpe_service_templates(vcpecommon): |
| 241 | sdc = sdcutils.SdcUtils(vcpecommon) |
| 242 | sdc.download_vcpe_service_template() |
| 243 | |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 244 | |
Kang Xi | 6c76239 | 2018-05-30 09:27:34 -0400 | [diff] [blame] | 245 | def tmp_sniro(): |
| 246 | logger = logging.getLogger(__name__) |
| 247 | |
| 248 | vcpecommon = VcpeCommon() |
| 249 | |
| 250 | svc_instance_uuid = vcpecommon.load_object(vcpecommon.svc_instance_uuid_file) |
| 251 | # Setting up SNIRO |
Brian Freeman | 9b3d6ca | 2019-11-06 13:22:53 -0500 | [diff] [blame] | 252 | config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brgemu']) |
Kang Xi | 6c76239 | 2018-05-30 09:27:34 -0400 | [diff] [blame] | 253 | |
Yang Xu | 0e319ef | 2019-04-30 14:28:07 -0400 | [diff] [blame] | 254 | |
Yang Xu | 64339a8 | 2018-12-30 05:32:21 +0000 | [diff] [blame] | 255 | def test(): |
| 256 | vcpecommon = VcpeCommon() |
Yang Xu | 65b84a4 | 2018-12-31 17:48:02 +0000 | [diff] [blame] | 257 | print("oom-k8s-04 public ip: %s" % (vcpecommon.get_vm_public_ip_by_nova('oom-k8s-04'))) |
Yang Xu | 64339a8 | 2018-12-30 05:32:21 +0000 | [diff] [blame] | 258 | |
Yang Xu | 0e319ef | 2019-04-30 14:28:07 -0400 | [diff] [blame] | 259 | |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 260 | if __name__ == '__main__': |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 261 | print('----------------------------------------------------------------------------------------------------') |
| 262 | print(' vcpe.py: Brief info about this program') |
| 263 | # print(' vcpe.py sdc: Onboard VNFs, design and distribute vCPE services (under development)') |
| 264 | print(' vcpe.py init: Add customer service data to SDNC and SO DBs.') |
| 265 | print(' vcpe.py infra: Deploy infrastructure, including DHCP, AAA, DNS, Web Server, vBNG, vGMUX, vBRG.') |
Brian Freeman | ec9fe0e | 2018-11-12 12:37:12 -0500 | [diff] [blame] | 266 | print(' vcpe.py brg: Deploy brg only (for testing after infra succeeds).') |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 267 | print(' vcpe.py customer: Deploy customer service, including vGW and VxLANs') |
Bartek Grzybowski | 304628b | 2019-10-17 10:44:39 +0200 | [diff] [blame] | 268 | print(' vcpe.py loop: Test closed loop control (packet loss set to 22)') |
| 269 | print(' vcpe.py noloss: Set vGMUX packet loss to 0') |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 270 | print('----------------------------------------------------------------------------------------------------') |
| 271 | |
| 272 | if len(sys.argv) != 2: |
| 273 | sys.exit() |
| 274 | |
| 275 | if sys.argv[1] == 'sdc': |
| 276 | print('Under development') |
| 277 | elif sys.argv[1] == 'init': |
Yang Xu | 0e319ef | 2019-04-30 14:28:07 -0400 | [diff] [blame] | 278 | init() |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 279 | init_so_sdnc() |
| 280 | elif sys.argv[1] == 'infra': |
Brian Freeman | 9b3d6ca | 2019-11-06 13:22:53 -0500 | [diff] [blame] | 281 | #if 'y' == raw_input('Ready to deploy infrastructure? y/n: ').lower(): |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 282 | deploy_infra() |
| 283 | elif sys.argv[1] == 'customer': |
| 284 | if 'y' == raw_input('Ready to deploy customer service? y/n: ').lower(): |
| 285 | deploy_custom_service() |
| 286 | elif sys.argv[1] == 'loop': |
| 287 | closed_loop(22) |
| 288 | elif sys.argv[1] == 'noloss': |
| 289 | closed_loop(0) |
| 290 | elif sys.argv[1] == 'brg': |
| 291 | deploy_brg_only() |
Yang Xu | 86c0e4a | 2018-12-02 13:10:41 -0500 | [diff] [blame] | 292 | elif sys.argv[1] == 'sniro': |
| 293 | tmp_sniro() |
Yang Xu | 64339a8 | 2018-12-30 05:32:21 +0000 | [diff] [blame] | 294 | elif sys.argv[1] == 'test': |
| 295 | test() |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 296 | |