def deploy_brg_only():
logger = logging.getLogger(__name__)
- vcpecommon = VcpeCommon()
+ vcpecommon = VcpeCommon(cfg_file=args.config)
preload_dict = vcpecommon.load_preload_data()
# name_suffix = preload_dict['${brg_bng_net}'].split('_')[-1]
name_suffix = datetime.now().strftime('%Y%m%d%H%M')
def deploy_infra():
logger = logging.getLogger(__name__)
- vcpecommon = VcpeCommon()
+ vcpecommon = VcpeCommon(cfg_file=args.config)
# preload all VNF-API networks
network_template = vcpecommon.find_file('network.', 'json', 'preload_templates')
def deploy_custom_service():
nodes = ['brg', 'mux']
- vcpecommon = VcpeCommon(nodes)
+ vcpecommon = VcpeCommon(nodes, cfg_file=args.config)
custom_service = vcpe_custom_service.CustomService(vcpecommon)
# clean up
def closed_loop(lossrate=0):
nodes = ['brg', 'mux']
logger = logging.getLogger('__name__')
- vcpecommon = VcpeCommon(nodes)
+ vcpecommon = VcpeCommon(nodes, cfg_file=args.config)
logger.info('Setting up closed loop policy')
policy_template_file = vcpecommon.find_file('operational.vcpe', 'json', 'preload_templates')
def init_so_sdnc():
logger = logging.getLogger('__name__')
- vcpecommon = VcpeCommon()
+ vcpecommon = VcpeCommon(cfg_file=args.config)
config_sdnc_so.insert_sdnc_ip_pool(vcpecommon)
config_sdnc_so.insert_customer_service_to_so(vcpecommon)
#config_sdnc_so.insert_customer_service_to_sdnc(vcpecommon)
def init():
- vcpecommon = VcpeCommon()
+ vcpecommon = VcpeCommon(cfg_file=args.config)
init_sdc(vcpecommon)
download_vcpe_service_templates(vcpecommon)
preloader = preload.Preload(vcpecommon)
def tmp_sniro():
logger = logging.getLogger(__name__)
- vcpecommon = VcpeCommon()
+ vcpecommon = VcpeCommon(cfg_file=args.config)
svc_instance_uuid = vcpecommon.load_object(vcpecommon.svc_instance_uuid_file)
# Setting up SNIRO
def test():
- vcpecommon = VcpeCommon()
+ vcpecommon = VcpeCommon(cfg_file=args.config)
print("oom-k8s-04 public ip: %s" % (vcpecommon.get_vm_public_ip_by_nova('oom-k8s-04')))
parser.add_argument('mode',metavar='MODE',
help='Script mode: {0}'.format('|'.join(modes.keys())),
choices=modes.keys())
+ parser.add_argument('--config',help='Configuration file path',default=None)
return parser
class VcpeCommon:
- def __init__(self, extra_host_names=None):
+ def __init__(self, extra_host_names=None, cfg_file=None):
self.logger = logging.getLogger(__name__)
self.logger.setLevel(logging.DEBUG)
self.logger.info('Initializing configuration')
+ self.default_config = 'vcpeconfig.yaml'
# Read configuration from config file
- self._load_config()
+ self._load_config(cfg_file)
self.sdnc_controller_pod = '-'.join([self.onap_environment, 'sdnc-sdnc-0'])
# OOM: this is the address that the brg and bng will nat for sdnc access - 10.0.0.x address of k8 host for sdnc-0 container
'Content-Type': 'application/json',
'X-FromAppId': 'postman', 'X-TransactionId': '9999'}
- def _load_config(self, cfg_file='vcpeconfig.yaml'):
+ def _load_config(self, cfg_file):
"""
Reads vcpe config file and injects settings as object's attributes
:param cfg_file: Configuration file path
"""
+ if cfg_file is None:
+ cfg_file = self.default_config
+
try:
with open(cfg_file, 'r') as cfg:
cfg_yml = yaml.full_load(cfg)