diff options
-rwxr-xr-x | juju/juju_connect.sh | 13 | ||||
-rw-r--r-- | juju/openo_connect.py | 38 | ||||
-rwxr-xr-x | open-o/openo_docker.sh | 2 |
3 files changed, 33 insertions, 20 deletions
diff --git a/juju/juju_connect.sh b/juju/juju_connect.sh index 0bc4ef9..2bc742b 100755 --- a/juju/juju_connect.sh +++ b/juju/juju_connect.sh @@ -64,15 +64,20 @@ function start_tomcat() FLUSH PRIVILEGES; EOF" - local cmd2="sed -i s/port=\"8080\"/port=\"8483\"/ /home/ubuntu/tomcat8/conf/server.xml; \ - ps aux | grep java | awk '{print \"$2\"}' | xargs kill -9; \ - /home/ubuntu/tomcat8/bin/catalina.sh start" + local cmd2='sed -i s/port=\"8080\"/port=\"8483\"/g /home/ubuntu/tomcat8/conf/server.xml' exec_cmd_on_client $cmd2 + + local cmd3="ps aux | grep java | awk '{print \"$2\"}' | xargs kill -9; \ + /home/ubuntu/tomcat8/bin/catalina.sh start" + exec_cmd_on_client $cmd3 } function add_vim_and_vnfm() { - python ${JUJU_DIR}/openo_connect.py $COMMON_SERVICES_MSB_IP $NFVO_DRIVER_VNFM_JUJU_IP + python ${JUJU_DIR}/openo_connect.py --msb_ip $COMMON_SERVICES_MSB_IP \ + --tosca_aria_ip $COMMON_TOSCA_ARIA_IP \ + --juju_client_ip $floating_ip_client \ + --auth_url $OS_AUTH_URL local cmd3="docker stop nfvo-driver-vnfm-juju; \ docker start nfvo-driver-vnfm-juju" diff --git a/juju/openo_connect.py b/juju/openo_connect.py index 782c7cb..7792082 100644 --- a/juju/openo_connect.py +++ b/juju/openo_connect.py @@ -8,6 +8,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +import argparse import sys import os import requests @@ -40,13 +41,9 @@ def add_common_tosca_aria(msb_ip, tosca_aria_ip): except Exception: raise -def add_openo_vim(msb_ip): +def add_openo_vim(msb_ip, auth_url): url = 'http://' + msb_ip + '/openoapi/extsys/v1/vims/' headers = {'Content-Type': 'application/json'} - if os.getenv('OS_AUTH_URL') is None: - raise RaiseError('env OS_AUTH_URL not found') - else: - auth_url = os.getenv('OS_AUTH_URL') data = {"name":"openstack", "url":auth_url, "userName":"admin", @@ -65,14 +62,10 @@ def add_openo_vim(msb_ip): except Exception: raise -def add_openo_vnfm(msb_ip): +def add_openo_vnfm(msb_ip, juju_client_ip): vnfm_url = 'http://' + msb_ip + '/openoapi/extsys/v1/vnfms' vim_url = 'http://' + msb_ip + '/openoapi/extsys/v1/vims' headers = {'Content-Type': 'application/json'} - if os.getenv('floating_ip_client') is None: - raise RaiseError('env floating_ip_client not found') - else: - juju_client_ip = os.getenv('floating_ip_client') try: resp = requests.get(vim_url) if resp.status_code not in (200,201): @@ -99,10 +92,25 @@ def add_openo_vnfm(msb_ip): if __name__ == "__main__": - if len(sys.argv) != 3: - raise RaiseError('input open-o ip error') + parser = argparse.ArgumentParser() + parser.add_argument("--msb_ip", action='store', help="common_services_msb ip") + parser.add_argument("--tosca_aria_ip", action='store', help="common_tosca_aria ip") + parser.add_argument("--juju_client_ip", action='store', help="juju client ip") + parser.add_argument("--auth_url", action='store', help="openstack auth url") + + args = parser.parse_args() + msb_ip = args.msb_ip + tosca_aria_ip = args.tosca_aria_ip + juju_client_ip = args.juju_client_ip + auth_url = args.auth_url + + if None in (msb_ip, tosca_aria_ip, juju_client_ip, auth_url): + missing = [] + for i in (msb_ip, tosca_aria_ip, juju_client_ip, auth_url): + if i is None: + missing.append(i) + raise RaiseError('missing parameter: %s' % missing) - _, msb_ip, tosca_aria_ip = sys.argv add_common_tosca_aria(msb_ip, tosca_aria_ip) - add_openo_vim(msb_ip) - add_openo_vnfm(msb_ip) + add_openo_vim(msb_ip, auth_url) + add_openo_vnfm(msb_ip, juju_client_ip) diff --git a/open-o/openo_docker.sh b/open-o/openo_docker.sh index d61edf7..2bee04b 100755 --- a/open-o/openo_docker.sh +++ b/open-o/openo_docker.sh @@ -73,7 +73,7 @@ function docker_pull() do echo "Try again" done - until docker pull openoint/nfvo-driver-vnfm-jujud + until docker pull openoint/nfvo-driver-vnfm-juju do echo "Try again" done |