Bartek Grzybowski | fbbdbec | 2019-09-25 16:37:05 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 2 | |
| 3 | import time |
| 4 | import logging |
| 5 | import json |
| 6 | import mysql.connector |
| 7 | import ipaddress |
| 8 | import re |
| 9 | import sys |
| 10 | import base64 |
| 11 | from vcpecommon import * |
| 12 | import preload |
| 13 | import commands |
| 14 | import vcpe_custom_service |
Bartek Grzybowski | 01abb5d | 2019-12-17 15:09:26 +0100 | [diff] [blame] | 15 | import argparse |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 16 | |
Bartek Grzybowski | 01abb5d | 2019-12-17 15:09:26 +0100 | [diff] [blame] | 17 | # Run the script with [-h|--help] to get usage info |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 18 | |
| 19 | logging.basicConfig(level=logging.INFO, format='%(message)s') |
| 20 | |
Bartek Grzybowski | 01abb5d | 2019-12-17 15:09:26 +0100 | [diff] [blame] | 21 | parser = argparse.ArgumentParser(formatter_class= |
| 22 | argparse.ArgumentDefaultsHelpFormatter) |
| 23 | parser.add_argument('--config',help='Configuration file path',default=None) |
| 24 | args = parser.parse_args() |
| 25 | |
| 26 | cpecommon = VcpeCommon(cfg_file=args.config) |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 27 | custom = vcpe_custom_service.CustomService(cpecommon) |
| 28 | |
| 29 | nodes=['mux'] |
| 30 | hosts = cpecommon.get_vm_ip(nodes) |
| 31 | |
| 32 | custom.del_vgmux_ves_mode(hosts['mux']) |
| 33 | time.sleep(2) |
| 34 | custom.del_vgmux_ves_collector(hosts['mux']) |
Yang Xu | 9f935b2 | 2018-11-22 10:56:52 -0500 | [diff] [blame] | 35 | #exit() |
Kang Xi | 11d278c | 2018-04-06 16:56:04 -0400 | [diff] [blame] | 36 | |
| 37 | time.sleep(2) |
| 38 | logging.info('Setting vGMUX DCAE collector IP address') |
| 39 | custom.set_vgmux_ves_collector(hosts['mux']) |
| 40 | time.sleep(2) |
| 41 | vgmux_vnf_name = cpecommon.load_object('vgmux_vnf_name') |
| 42 | logging.info('vGMUX VNF instance name is %s', vgmux_vnf_name) |
| 43 | logging.info('Letting vGMUX report packet loss to DCAE') |
| 44 | custom.set_vgmux_packet_loss_rate(hosts['mux'], 55, vgmux_vnf_name) |