#!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import os
import sys
import errno
import subprocess
import time
import argparse
import re
import json
from pprint import pprint

sys.path.insert(0, os.path.realpath('/usr/lib/python2.7/site-packages'))
sys.path.insert(
    0,
    os.path.realpath('/opt/contrail/api-venv/lib/python2.7/site-packages/vnc_cfg_api_server/'))

from vnc_api.vnc_api import *
from vnc_api.common import exceptions as vnc_exceptions
import vnc_cfg_api_server


class ContrailConfigCmd(object):
    def __init__(self, args_str=None):
        self._args = None
        if not args_str:
            args_str = ' '.join(sys.argv[1:])
        self._parse_args(args_str)

        # connect to vnc server
        self._vnc_lib = VncApi('u', 'p',
                               api_server_host=self._args.listen_ip_addr,
                               api_server_port=self._args.listen_port)

        self.re_parser = re.compile('[ \t\n]+')
        self.final_list = []
    #end __init__

    def _parse_args(self, args_str):