-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSDNController.gen.go
182 lines (149 loc) · 4.79 KB
/
SDNController.gen.go
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
180
181
182
// This is a generated file. DO NOT EDIT manually.
//go:generate goimports -w SDNController.gen.go
package go_xen_client
import (
"reflect"
"strconv"
"github.com/nilshell/xmlrpc"
)
//SDNController: Describes the SDN controller that is to connect with the pool
type SDNController struct {
Uuid string // Unique identifier/object reference
Protocol SdnControllerProtocol // Protocol to connect with SDN controller
Address string // IP address of the controller
Port int // TCP port of the controller
}
func FromSDNControllerToXml(SDN_controller *SDNController) (result xmlrpc.Struct) {
result = make(xmlrpc.Struct)
result["uuid"] = SDN_controller.Uuid
result["protocol"] = SDN_controller.Protocol.String()
result["address"] = SDN_controller.Address
result["port"] = strconv.Itoa(SDN_controller.Port)
return result
}
func ToSDNController(obj interface{}) (resultObj *SDNController) {
objValue := reflect.ValueOf(obj)
resultObj = &SDNController{}
for _, oKey := range objValue.MapKeys() {
keyName := oKey.String()
keyValue := objValue.MapIndex(oKey).Interface()
switch keyName {
case "uuid":
if v, ok := keyValue.(string); ok {
resultObj.Uuid = v
}
case "protocol":
if v, ok := keyValue.(SdnControllerProtocol); ok {
resultObj.Protocol = v
}
case "address":
if v, ok := keyValue.(string); ok {
resultObj.Address = v
}
case "port":
if v, ok := keyValue.(int); ok {
resultObj.Port = v
}
}
}
return resultObj
}
/* GetAllRecords: Return a map of SDN_controller references to SDN_controller records for all SDN_controllers known to the system. */
func (client *XenClient) SDNControllerGetAllRecords() (result map[string]SDNController, err error) {
obj, err := client.APICall("SDN_controller.get_all_records")
if err != nil {
return
}
interim := reflect.ValueOf(obj)
result = map[string]SDNController{}
for _, key := range interim.MapKeys() {
obj := interim.MapIndex(key)
mapObj := ToSDNController(obj.Interface())
result[key.String()] = *mapObj
}
return
}
/* GetAll: Return a list of all the SDN_controllers known to the system. */
func (client *XenClient) SDNControllerGetAll() (result []string, err error) {
obj, err := client.APICall("SDN_controller.get_all")
if err != nil {
return
}
result = make([]string, len(obj.([]interface{})))
for i, value := range obj.([]interface{}) {
result[i] = value.(string)
}
return
}
/* Forget: Remove the OVS manager of the pool and destroy the db record. */
func (client *XenClient) SDNControllerForget(self string) (err error) {
_, err = client.APICall("SDN_controller.forget", self)
if err != nil {
return
}
// no return result
return
}
/* Introduce: Introduce an SDN controller to the pool. */
func (client *XenClient) SDNControllerIntroduce(protocol SdnControllerProtocol, address string, port int) (result string, err error) {
obj, err := client.APICall("SDN_controller.introduce", protocol.String(), address, port)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetPort: Get the port field of the given SDN_controller. */
func (client *XenClient) SDNControllerGetPort(self string) (result int, err error) {
obj, err := client.APICall("SDN_controller.get_port", self)
if err != nil {
return
}
result = obj.(int)
return
}
/* GetAddress: Get the address field of the given SDN_controller. */
func (client *XenClient) SDNControllerGetAddress(self string) (result string, err error) {
obj, err := client.APICall("SDN_controller.get_address", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetProtocol: Get the protocol field of the given SDN_controller. */
func (client *XenClient) SDNControllerGetProtocol(self string) (result SdnControllerProtocol, err error) {
obj, err := client.APICall("SDN_controller.get_protocol", self)
if err != nil {
return
}
result = ToSdnControllerProtocol(obj.(string))
return
}
/* GetUuid: Get the uuid field of the given SDN_controller. */
func (client *XenClient) SDNControllerGetUuid(self string) (result string, err error) {
obj, err := client.APICall("SDN_controller.get_uuid", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetByUuid: Get a reference to the SDN_controller instance with the specified UUID. */
func (client *XenClient) SDNControllerGetByUuid(uuid string) (result string, err error) {
obj, err := client.APICall("SDN_controller.get_by_uuid", uuid)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetRecord: Get a record containing the current state of the given SDN_controller. */
func (client *XenClient) SDNControllerGetRecord(self string) (result SDNController, err error) {
obj, err := client.APICall("SDN_controller.get_record", self)
if err != nil {
return
}
result = *ToSDNController(obj.(interface{}))
return
}