-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.sh
More file actions
executable file
·56 lines (42 loc) · 2 KB
/
Copy pathclient.sh
File metadata and controls
executable file
·56 lines (42 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
host_ip=$1
host_port=$2
# Default
if [ -z $host_ip ] ; then
host_ip="localhost"
fi
if [ -z $host_port ] ; then
host_port=10001
fi
# Util
pause () {
read -p "$*"
}
echo "Host IP = $host_ip"
echo "Host Port = $host_port"
pause 'Press [Enter] key to continue or [Ctrl+C] to exit ...'
echo ''
# Create access node
curl --verbose -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ "name":"vmxTestAccess", "mgmt_ip": "169.254.0.22", "role": "access" }' "http://${host_ip}:${host_port}/network-elements"
echo; echo
# Create service node
curl --verbose -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ "name":"vmxTestService", "mgmt_ip": "169.254.0.20", "role": "service" }' "http://${host_ip}:${host_port}/network-elements"
echo; echo
# Create conn-link
curl --verbose -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ "name":"conn-one", "access_node": "vmxTestAccess", "access_links": ["ge-0/0/1", "ge-0/0/2"], "service_node": "vmxTestService", "service_links": ["ge-1/0/1", "ge-2/0/2"], "fabric": null }' "http://${host_ip}:${host_port}/conn-links"
echo; echo
# Get all nodes
curl --verbose -X GET -H "Content-Type: application/json" -H "Cache-Control: no-cache" "http://${host_ip}:${host_port}/network-elements"
echo; echo
# Get all conn-links
curl -verbose -X GET -H "Content-Type: application/json" -H "Cache-Control: no-cache" "http://${host_ip}:${host_port}/conn-links"
echo; echo
# Remove conn-link
curl --verbose -X DELETE -H "Content-Type: application/json" -H "Cache-Control: no-cache" "http://${host_ip}:${host_port}/conn-links/conn-one"
echo; echo
# Remove access-node
curl --verbose -X DELETE -H "Content-Type: application/json" -H "Cache-Control: no-cache" "http://${host_ip}:${host_port}/network-elements/vmxTestAccess"
echo; echo
# Remove service-node
curl --verbose -X DELETE -H "Content-Type: application/json" -H "Cache-Control: no-cache" "http://${host_ip}:${host_port}/network-elements/vmxTestService"
echo; echo