-
Notifications
You must be signed in to change notification settings - Fork 0
/
tpn_plugin.rb
179 lines (138 loc) · 3.58 KB
/
tpn_plugin.rb
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name 'Telstra Programmable Network Self-Service Plugin'
type 'plugin'
rs_ca_ver 20161221
short_description "Telstra Programmable Network Self-Service Plugin"
long_description "Version: 0.1"
package "plugins/telstra_programmable_network"
import "sys_log"
plugin "telstra_programmable_network" do
endpoint do
default_host "https://penapi.pacnetconnect.com"
default_scheme "https"
end
type "topology" do
href_templates "/ttms/1.0.0/topology_tag/{{uuid}}","/ttms/1.0.0/topology_tag/{{[*].uuid}}"
field "name" do
required true
type "string"
end
field "authorization" do
type "string"
location "header"
end
field "description" do
required true
type "string"
end
action "create" do
verb "POST"
path "/ttms/1.0.0/topology_tag"
type "topology"
field "authorization" do
location "header"
end
end
action "list" do
verb "GET"
path "/ttms/1.0.0/topology_tag"
type "topology"
field "authorization" do
location "header"
end
end
action "show" do
path "/ttms/1.0.0/topology_tag/$uuid"
verb "GET"
type "topology"
field "authorization" do
location "header"
end
field "uuid" do
location "path"
end
end
link "objects" do
path "$href/objects"
type "topology_objects"
end
action "destroy" do
path "/ttms/1.0.0/topology_tag/$uuid"
field "authorization" do
location "header"
end
end
output "uuid","name","description","status","customer_uuid","nsd_uuid","gui_topology","created_by","creation_date","deletion_date"
end
type "topology_objects" do
href_templates "/ttms/1.0.0/topology_tag/{{topology_tag}}/objects"
provision "no_operation"
delete "no_operation"
action "show" do
path "/ttms/1.0.0/topology_tag/$uuid/objects"
verb "GET"
type "topology_objects"
field "authorization" do
location "header"
end
field "uuid" do
location "path"
end
end
output "endpoints", "links", "sharedvports", "topology_tag"
end
type "endpoint" do
href_templates "/1.0.0/inventory/endpoint/{{datacenter[0].port[0].endpointuuid}}","/1.0.0/inventory/endpoint/{{endpointlist[*].endpointuuid}}"
provision "no_operation"
delete "no_operation"
action "list" do
verb "GET"
path "/1.0.0/inventory/endpoints/customeruuid/$customer_uuid"
type "endpoint"
field "authorization" do
location "header"
end
field "customer_uuid" do
location "path"
end
output_path "endpointlist[]"
end
action "show" do
verb "GET"
path "/1.0.0/inventory/endpoint/$endpointuuid" # "$href"
field "authorization" do
location "header"
end
field "endpointuuid" do
location "path"
end
output_path "datacenter[]"
end
output "endpointuuid", "datacenteruuid"
output "port" do
type "array"
end
end
# type "session" do
# href_templates "{{access_token}}"
# field "body" do
# type "string"
# location "body"
# end
# action "create" do
# verb "POST"
# path "/1.0.0/auth/generatetoken"
# type "session"
# end
# end
end
define no_operation(@declaration) do
end
resource_pool "telstra_programmable_network" do
plugin $telstra_programmable_network
# auth "tpn_auth", type: "api_key" do
# key cred("TPN_ACCESS_TOKEN")
# location "header"
# field "Authorization"
# type "Bearer"
# end
end