blob: 36c1eda413739742cb06d2bdab17aef2c1f51ab7 [file] [log] [blame]
Pingping Lin82366d32016-08-31 00:21:56 +00001FN=$SETUPDIR/vtn-external.yaml
2
3rm -f $FN
4
5cat >> $FN <<EOF
6tosca_definitions_version: tosca_simple_yaml_1_0
7
8imports:
9 - custom_types/xos.yaml
10
11description: autogenerated node tags file for VTN configuration
12
13topology_template:
14 node_templates:
15
16 service#ONOS_CORD:
17 type: tosca.nodes.ONOSService
18 requirements:
19 properties:
Pingping Lin434cf8f2016-09-23 17:03:40 +000020 kind: CORD-Platform
Pingping Lin82366d32016-08-31 00:21:56 +000021 view_url: /admin/onos/onosservice/\$id$/
22 no_container: true
23 rest_hostname: onos-cord
24 replaces: service_ONOS_CORD
25
26 service#vtn:
27 type: tosca.nodes.VTNService
28 properties:
Pingping Lin434cf8f2016-09-23 17:03:40 +000029 kind: CORD-Platform
Pingping Lin82366d32016-08-31 00:21:56 +000030 view_url: /admin/vtn/vtnservice/\$id$/
31 privateGatewayMac: 00:00:00:00:00:01
32 localManagementIp: 10.102.83.2/24
33 ovsdbPort: 6641
34 sshUser: root
35 sshKeyFile: /root/node_key
36 sshPort: 22
37 xosEndpoint: http://xos/
38 xosUser: padmin@vicci.org
39 xosPassword: letmein
40 replaces: service_vtn
41
42EOF
43
44NODES=$( bash -c "source $SETUPDIR/admin-openrc.sh ; nova host-list" |grep compute|awk '{print $2}' )
45I=0
46BRIDGE_IDX=1
47for NODE in $NODES; do
48 echo $NODE
49 BRIDGE_ID=$(printf "of:%016d" $BRIDGE_IDX )
50 BRIDGE_IDX=$(expr $BRIDGE_IDX + 1)
51 FIP=$(ssh -i node_key -o StrictHostKeyChecking=no $NODE ip -4 addr show fabric 2> /dev/null | grep inet | awk '{print $2}')
52 if [ -z "$FIP" ]
53 then
54 # Single-node POD case
55 FIP="10.168.0.253/24"
56 fi
57
58 cat >> $FN <<EOF
59 $NODE:
60 type: tosca.nodes.Node
61
62 # VTN bridgeId field for node $NODE
63 ${NODE}_bridgeId_tag:
64 type: tosca.nodes.Tag
65 properties:
66 name: bridgeId
67 value: $BRIDGE_ID
68 requirements:
69 - target:
70 node: $NODE
71 relationship: tosca.relationships.TagsObject
72 - service:
73 node: service#ONOS_CORD
74 relationship: tosca.relationships.MemberOfService
75
76 # VTN dataPlaneIntf field for node $NODE
77 ${NODE}_dataPlaneIntf_tag:
78 type: tosca.nodes.Tag
79 properties:
80 name: dataPlaneIntf
81 value: fabric
82 requirements:
83 - target:
84 node: $NODE
85 relationship: tosca.relationships.TagsObject
86 - service:
87 node: service#ONOS_CORD
88 relationship: tosca.relationships.MemberOfService
89
90 # VTN dataPlaneIp field for node $NODE
91 ${NODE}_dataPlaneIp_tag:
92 type: tosca.nodes.Tag
93 properties:
94 name: dataPlaneIp
95 value: $FIP
96 requirements:
97 - target:
98 node: $NODE
99 relationship: tosca.relationships.TagsObject
100 - service:
101 node: service#ONOS_CORD
102 relationship: tosca.relationships.MemberOfService
103
104EOF
105done
106
107cat >> $FN <<EOF
108 VTN_ONOS_app:
109 type: tosca.nodes.ONOSVTNApp
110 requirements:
111 - onos_tenant:
112 node: service#ONOS_CORD
113 relationship: tosca.relationships.TenantOfService
114 - vtn_service:
115 node: service#vtn
116 relationship: tosca.relationships.UsedByService
117 properties:
118 install_dependencies: http://mavenrepo:8080/repository/org/opencord/cord-config/1.1-SNAPSHOT/cord-config-1.1-SNAPSHOT.oar,http://mavenrepo:8080/repository/org/opencord/vtn/1.1-SNAPSHOT/vtn-1.1-SNAPSHOT.oar
119 dependencies: org.onosproject.drivers, org.onosproject.drivers.ovsdb, org.onosproject.openflow-base, org.onosproject.ovsdb-base, org.onosproject.dhcp
120 autogenerate: vtn-network-cfg
121EOF