@@ -214,6 +214,7 @@ type EndpointGroup struct {
214
214
215
215
ExtContractsGrps []string `json:"extContractsGrps,omitempty"`
216
216
GroupName string `json:"groupName,omitempty"` // Group name
217
+ NetProfile string `json:"netProfile,omitempty"` // Network profile name
217
218
NetworkName string `json:"networkName,omitempty"` // Network
218
219
Policies []string `json:"policies,omitempty"`
219
220
TenantName string `json:"tenantName,omitempty"` // Tenant
@@ -231,6 +232,7 @@ type EndpointGroupLinkSets struct {
231
232
232
233
type EndpointGroupLinks struct {
233
234
AppProfile Link `json:"AppProfile,omitempty"`
235
+ NetProfile Link `json:"NetProfile,omitempty"`
234
236
Network Link `json:"Network,omitempty"`
235
237
Tenant Link `json:"Tenant,omitempty"`
236
238
}
@@ -286,6 +288,32 @@ type GlobalInspect struct {
286
288
Oper GlobalOper
287
289
}
288
290
291
+ type Netprofile struct {
292
+ // every object has a key
293
+ Key string `json:"key,omitempty"`
294
+
295
+ DSCP int `json:"DSCP,omitempty"` // DSCP
296
+ Bandwidth string `json:"bandwidth,omitempty"` // Allocated bandwidth
297
+ ProfileName string `json:"profileName,omitempty"` // Network profile name
298
+ TenantName string `json:"tenantName,omitempty"` // Tenant name
299
+
300
+ // add link-sets and links
301
+ LinkSets NetprofileLinkSets `json:"link-sets,omitempty"`
302
+ Links NetprofileLinks `json:"links,omitempty"`
303
+ }
304
+
305
+ type NetprofileLinkSets struct {
306
+ EndpointGroups map [string ]Link `json:"EndpointGroups,omitempty"`
307
+ }
308
+
309
+ type NetprofileLinks struct {
310
+ Tenant Link `json:"Tenant,omitempty"`
311
+ }
312
+
313
+ type NetprofileInspect struct {
314
+ Config Netprofile
315
+ }
316
+
289
317
type Network struct {
290
318
// every object has a key
291
319
Key string `json:"key,omitempty"`
@@ -435,6 +463,7 @@ type Tenant struct {
435
463
type TenantLinkSets struct {
436
464
AppProfiles map [string ]Link `json:"AppProfiles,omitempty"`
437
465
EndpointGroups map [string ]Link `json:"EndpointGroups,omitempty"`
466
+ NetProfiles map [string ]Link `json:"NetProfiles,omitempty"`
438
467
Networks map [string ]Link `json:"Networks,omitempty"`
439
468
Policies map [string ]Link `json:"Policies,omitempty"`
440
469
Servicelbs map [string ]Link `json:"Servicelbs,omitempty"`
@@ -929,6 +958,88 @@ func (c *ContivClient) GlobalInspect(name string) (*GlobalInspect, error) {
929
958
return & obj , nil
930
959
}
931
960
961
+ // NetprofilePost posts the netprofile object
962
+ func (c * ContivClient ) NetprofilePost (obj * Netprofile ) error {
963
+ // build key and URL
964
+ keyStr := obj .TenantName + ":" + obj .ProfileName
965
+ url := c .baseURL + "/api/v1/netprofiles/" + keyStr + "/"
966
+
967
+ // http post the object
968
+ err := httpPost (url , obj )
969
+ if err != nil {
970
+ log .Debugf ("Error creating netprofile %+v. Err: %v" , obj , err )
971
+ return err
972
+ }
973
+
974
+ return nil
975
+ }
976
+
977
+ // NetprofileList lists all netprofile objects
978
+ func (c * ContivClient ) NetprofileList () (* []* Netprofile , error ) {
979
+ // build key and URL
980
+ url := c .baseURL + "/api/v1/netprofiles/"
981
+
982
+ // http get the object
983
+ var objList []* Netprofile
984
+ err := httpGet (url , & objList )
985
+ if err != nil {
986
+ log .Debugf ("Error getting netprofiles. Err: %v" , err )
987
+ return nil , err
988
+ }
989
+
990
+ return & objList , nil
991
+ }
992
+
993
+ // NetprofileGet gets the netprofile object
994
+ func (c * ContivClient ) NetprofileGet (tenantName string , profileName string ) (* Netprofile , error ) {
995
+ // build key and URL
996
+ keyStr := tenantName + ":" + profileName
997
+ url := c .baseURL + "/api/v1/netprofiles/" + keyStr + "/"
998
+
999
+ // http get the object
1000
+ var obj Netprofile
1001
+ err := httpGet (url , & obj )
1002
+ if err != nil {
1003
+ log .Debugf ("Error getting netprofile %+v. Err: %v" , keyStr , err )
1004
+ return nil , err
1005
+ }
1006
+
1007
+ return & obj , nil
1008
+ }
1009
+
1010
+ // NetprofileDelete deletes the netprofile object
1011
+ func (c * ContivClient ) NetprofileDelete (tenantName string , profileName string ) error {
1012
+ // build key and URL
1013
+ keyStr := tenantName + ":" + profileName
1014
+ url := c .baseURL + "/api/v1/netprofiles/" + keyStr + "/"
1015
+
1016
+ // http get the object
1017
+ err := httpDelete (url )
1018
+ if err != nil {
1019
+ log .Debugf ("Error deleting netprofile %s. Err: %v" , keyStr , err )
1020
+ return err
1021
+ }
1022
+
1023
+ return nil
1024
+ }
1025
+
1026
+ // NetprofileInspect gets the netprofileInspect object
1027
+ func (c * ContivClient ) NetprofileInspect (tenantName string , profileName string ) (* NetprofileInspect , error ) {
1028
+ // build key and URL
1029
+ keyStr := tenantName + ":" + profileName
1030
+ url := c .baseURL + "/api/v1/inspect/netprofiles/" + keyStr + "/"
1031
+
1032
+ // http get the object
1033
+ var obj NetprofileInspect
1034
+ err := httpGet (url , & obj )
1035
+ if err != nil {
1036
+ log .Debugf ("Error getting netprofile %+v. Err: %v" , keyStr , err )
1037
+ return nil , err
1038
+ }
1039
+
1040
+ return & obj , nil
1041
+ }
1042
+
932
1043
// NetworkPost posts the network object
933
1044
func (c * ContivClient ) NetworkPost (obj * Network ) error {
934
1045
// build key and URL
0 commit comments