Changes from feature/cord-pod-deploy branch of XOS repo
Change-Id: I67a1b4aa8e0da491bf0a5eff9ec05aa7cb04567d
diff --git a/xos/synchronizer/steps/sync_onosapp.py b/xos/synchronizer/steps/sync_onosapp.py
index 78a8cc8..d421aa1 100644
--- a/xos/synchronizer/steps/sync_onosapp.py
+++ b/xos/synchronizer/steps/sync_onosapp.py
@@ -178,7 +178,7 @@
data = {
"apps" : {
- "org.onosproject.cordvtn" : {
+ "org.opencord.vtn" : {
"cordvtn" : {
"privateGatewayMac" : privateGatewayMac,
"localManagementIp": localManagementIp,
@@ -206,7 +206,7 @@
}
}
- # Generate apps->org.onosproject.cordvtn->cordvtn->nodes
+ # Generate apps->org.opencord.vtn->cordvtn->nodes
nodes = Node.objects.all()
for node in nodes:
nodeip = socket.gethostbyname(node.name)
@@ -226,7 +226,7 @@
"dataPlaneIntf": dataPlaneIntf,
"dataPlaneIp": dataPlaneIp
}
- data["apps"]["org.onosproject.cordvtn"]["cordvtn"]["nodes"].append(node_dict)
+ data["apps"]["org.opencord.vtn"]["cordvtn"]["nodes"].append(node_dict)
# Generate apps->org.onosproject.cordvtn->cordvtn->publicGateways
# Pull the gateway information from vRouter
@@ -239,7 +239,7 @@
"gatewayIp": gatewayIp,
"gatewayMac": gatewayMac
}
- data["apps"]["org.onosproject.cordvtn"]["cordvtn"]["publicGateways"].append(gateway_dict)
+ data["apps"]["org.opencord.vtn"]["cordvtn"]["publicGateways"].append(gateway_dict)
return json.dumps(data, indent=4, sort_keys=True)
@@ -491,6 +491,11 @@
else:
fields["dependencies"] = []
+ if o.install_dependencies:
+ fields["install_dependencies"] = [x.strip() for x in o.install_dependencies.split(",")]
+ else:
+ fields["install_dependencies"] = []
+
return fields
def get_extra_attributes_full(self, o):
@@ -503,11 +508,6 @@
fields["component_configs"] = o.component_configs
fields["node_key_fn"] = o.node_key_fn
- if o.install_dependencies:
- fields["install_dependencies"] = [x.strip() for x in o.install_dependencies.split(",")]
- else:
- fields["install_dependencies"] = []
-
if (instance.isolation=="container"):
fields["ONOS_container"] = "%s-%s" % (instance.slice.name, str(instance.id))
else:
diff --git a/xos/synchronizer/steps/sync_onosapp_nocontainer.yaml b/xos/synchronizer/steps/sync_onosapp_nocontainer.yaml
index 5aad569..33b456e 100644
--- a/xos/synchronizer/steps/sync_onosapp_nocontainer.yaml
+++ b/xos/synchronizer/steps/sync_onosapp_nocontainer.yaml
@@ -18,21 +18,27 @@
body: "{{ '{{' }} lookup('file', '{{ files_dir }}/{{ rest_config.fn }}') {{ '}}' }}"
{% endfor %}
{% endif %}
-{% if early_rest_configs %}
- early_rest_configs:
-{% for early_rest_config in early_rest_configs %}
- - endpoint: {{ early_rest_config.endpoint }}
- body: "{{ '{{' }} lookup('file', '{{ files_dir }}/{{ early_rest_config.fn }}') {{ '}}' }}"
-{% endfor %}
-{% endif %}
rest_hostname: {{ rest_hostname }}
rest_port: {{ rest_port }}
tasks:
+{% if install_dependencies %}
+ # Couldn't figure out how to get uri module to accept JSON in a string
+ - name: Install ONOS apps by URL
+ command: curl -sS --user onos:rocks -X POST -HContent-Type:application/json -d '{{ '{{' }} item.body | to_json {{ '}}' }}' http://{{ rest_hostname }}:{{ rest_port }}/{{ '{{' }} item.endpoint {{ '}}' }}
+ with_items:
+ {% for install_dependency in install_dependencies %}
+ - endpoint: "onos/v1/applications"
+ body:
+ url: "{{ install_dependency }}"
+ activate: "true"
+ {% endfor %}
+{% endif %}
+
{% if dependencies %}
- name: Add dependencies to ONOS
uri:
- url: http://{{ '{{' }} rest_hostname {{ '}}' }}:{{ '{{' }} rest_port {{ '}}' }}/onos/v1/applications/{{ '{{' }} item {{ '}}' }}/active
+ url: http://{{ rest_hostname }}:{{ rest_port }}/onos/v1/applications/{{ '{{' }} item {{ '}}' }}/active
method: POST
user: karaf
password: karaf
@@ -47,7 +53,7 @@
# vOLT will re-read its net config; vbng may not.
- name: Add ONOS configuration values
uri:
- url: http://{{ '{{' }} rest_hostname {{ '}}' }}:{{ '{{' }} rest_port {{ '}}' }}/{{ '{{' }} item.endpoint {{ '}}' }} #http://localhost:8181/onos/v1/network/configuration/
+ url: http://{{ rest_hostname }}:{{ rest_port }}/{{ '{{' }} item.endpoint {{ '}}' }} #http://localhost:8181/onos/v1/network/configuration/
body: "{{ '{{' }} item.body {{ '}}' }}"
body_format: raw
method: POST