blob: 2bdc28214ee1a9e3b187b8c3118b68a0bd2dbfbb [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:
20 kind: onos
21 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:
29 view_url: /admin/vtn/vtnservice/\$id$/
30 privateGatewayMac: 00:00:00:00:00:01
31 localManagementIp: 10.102.83.2/24
32 ovsdbPort: 6641
33 sshUser: root
34 sshKeyFile: /root/node_key
35 sshPort: 22
36 xosEndpoint: http://xos/
37 xosUser: padmin@vicci.org
38 xosPassword: letmein
39 replaces: service_vtn
40
41EOF
42
43NODES=$( bash -c "source $SETUPDIR/admin-openrc.sh ; nova host-list" |grep compute|awk '{print $2}' )
44I=0
45BRIDGE_IDX=1
46for NODE in $NODES; do
47 echo $NODE
48 BRIDGE_ID=$(printf "of:%016d" $BRIDGE_IDX )
49 BRIDGE_IDX=$(expr $BRIDGE_IDX + 1)
50 FIP=$(ssh -i node_key -o StrictHostKeyChecking=no $NODE ip -4 addr show fabric 2> /dev/null | grep inet | awk '{print $2}')
51 if [ -z "$FIP" ]
52 then
53 # Single-node POD case
54 FIP="10.168.0.253/24"
55 fi
56
57 cat >> $FN <<EOF
58 $NODE:
59 type: tosca.nodes.Node
60
61 # VTN bridgeId field for node $NODE
62 ${NODE}_bridgeId_tag:
63 type: tosca.nodes.Tag
64 properties:
65 name: bridgeId
66 value: $BRIDGE_ID
67 requirements:
68 - target:
69 node: $NODE
70 relationship: tosca.relationships.TagsObject
71 - service:
72 node: service#ONOS_CORD
73 relationship: tosca.relationships.MemberOfService
74
75 # VTN dataPlaneIntf field for node $NODE
76 ${NODE}_dataPlaneIntf_tag:
77 type: tosca.nodes.Tag
78 properties:
79 name: dataPlaneIntf
80 value: fabric
81 requirements:
82 - target:
83 node: $NODE
84 relationship: tosca.relationships.TagsObject
85 - service:
86 node: service#ONOS_CORD
87 relationship: tosca.relationships.MemberOfService
88
89 # VTN dataPlaneIp field for node $NODE
90 ${NODE}_dataPlaneIp_tag:
91 type: tosca.nodes.Tag
92 properties:
93 name: dataPlaneIp
94 value: $FIP
95 requirements:
96 - target:
97 node: $NODE
98 relationship: tosca.relationships.TagsObject
99 - service:
100 node: service#ONOS_CORD
101 relationship: tosca.relationships.MemberOfService
102
103EOF
104done
105
106cat >> $FN <<EOF
107 VTN_ONOS_app:
108 type: tosca.nodes.ONOSVTNApp
109 requirements:
110 - onos_tenant:
111 node: service#ONOS_CORD
112 relationship: tosca.relationships.TenantOfService
113 - vtn_service:
114 node: service#vtn
115 relationship: tosca.relationships.UsedByService
116 properties:
117 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
118 dependencies: org.onosproject.drivers, org.onosproject.drivers.ovsdb, org.onosproject.openflow-base, org.onosproject.ovsdb-base, org.onosproject.dhcp
119 autogenerate: vtn-network-cfg
120EOF