@@ -88,9 +88,9 @@ func extContractsGrpValidateAndRegister(epg *contivModel.EndpointGroup,
88
88
// Cleanup external contracts from an epg.
89
89
func cleanupExternalContracts (endpointGroup * contivModel.EndpointGroup ) error {
90
90
// Cleanup consumed external contracts
91
- tenant := endpointGroup .TenantName
91
+ tenant := endpointGroup .TenantName
92
92
for _ , consExtContractsGrp := range endpointGroup .ConsExtContractsGrps {
93
- contractsGrpKey := tenant + ":" + consExtContractsGrp
93
+ contractsGrpKey := tenant + ":" + consExtContractsGrp
94
94
contractsGrp := contivModel .FindExtContractsGroup (contractsGrpKey )
95
95
err := extContractsGrpDeregister (endpointGroup , contractsGrp , "consumed" )
96
96
if err != nil {
@@ -103,7 +103,7 @@ func cleanupExternalContracts(endpointGroup *contivModel.EndpointGroup) error {
103
103
104
104
// Cleanup provided external contracts
105
105
for _ , provExtContractsGrp := range endpointGroup .ProvExtContractsGrps {
106
- contractsGrpKey := tenant + ":" + provExtContractsGrp
106
+ contractsGrpKey := tenant + ":" + provExtContractsGrp
107
107
contractsGrp := contivModel .FindExtContractsGroup (contractsGrpKey )
108
108
err := extContractsGrpDeregister (endpointGroup , contractsGrp , "provided" )
109
109
if err != nil {
@@ -121,9 +121,9 @@ func cleanupExternalContracts(endpointGroup *contivModel.EndpointGroup) error {
121
121
func setupExternalContracts (endpointGroup * contivModel.EndpointGroup ,
122
122
consContractsGrps , provContractsGrps []string ) error {
123
123
// Validate presence and register consumed external contracts
124
- tenant := endpointGroup .TenantName
124
+ tenant := endpointGroup .TenantName
125
125
for _ , consExtContractsGrp := range consContractsGrps {
126
- contractsGrpKey := tenant + ":" + consExtContractsGrp
126
+ contractsGrpKey := tenant + ":" + consExtContractsGrp
127
127
contractsGrp := contivModel .FindExtContractsGroup (contractsGrpKey )
128
128
err := extContractsGrpValidateAndRegister (endpointGroup , contractsGrp , "consumed" )
129
129
if err != nil {
@@ -133,7 +133,7 @@ func setupExternalContracts(endpointGroup *contivModel.EndpointGroup,
133
133
134
134
// Validate presence and register provided external contracts
135
135
for _ , provExtContractsGrp := range provContractsGrps {
136
- contractsGrpKey := tenant + ":" + provExtContractsGrp
136
+ contractsGrpKey := tenant + ":" + provExtContractsGrp
137
137
contractsGrp := contivModel .FindExtContractsGroup (contractsGrpKey )
138
138
err := extContractsGrpValidateAndRegister (endpointGroup , contractsGrp , "provided" )
139
139
if err != nil {
@@ -155,32 +155,32 @@ func isExtContractsGroupUsed(contractsGroup *contivModel.ExtContractsGroup) bool
155
155
156
156
// ExtContractsGroupCreate creates a new group of external contracts
157
157
func (ac * APIController ) ExtContractsGroupCreate (contractsGroup * contivModel.ExtContractsGroup ) error {
158
- log .Infof ("Received ExtContractsGroupCreate: %+v" , contractsGroup )
158
+ log .Infof ("Received ExtContractsGroupCreate: %+v" , contractsGroup )
159
159
160
- // NOTE: Nothing more needs to be done here. This object
161
- // need not be created in the masterCfg.
160
+ // NOTE: Nothing more needs to be done here. This object
161
+ // need not be created in the masterCfg.
162
162
163
- return nil
163
+ return nil
164
164
}
165
165
166
166
// ExtContractsGroupUpdate updates an existing group of contract sets
167
167
func (ac * APIController ) ExtContractsGroupUpdate (contractsGroup , params * contivModel.ExtContractsGroup ) error {
168
- log .Infof ("Received ExtContractsGroupUpdate: %+v, params: %+v" , contractsGroup , params )
169
- log .Errorf ("Error: external contracts update not supported: %s" , contractsGroup .ContractsGroupName )
168
+ log .Infof ("Received ExtContractsGroupUpdate: %+v, params: %+v" , contractsGroup , params )
169
+ log .Errorf ("Error: external contracts update not supported: %s" , contractsGroup .ContractsGroupName )
170
170
171
- return core .Errorf ("external contracts update not supported" )
171
+ return core .Errorf ("external contracts update not supported" )
172
172
}
173
173
174
174
// ExtContractsGroupDelete deletes an existing external contracts group
175
175
func (ac * APIController ) ExtContractsGroupDelete (contractsGroup * contivModel.ExtContractsGroup ) error {
176
- log .Infof ("Received ExtContractsGroupDelete: %+v" , contractsGroup )
176
+ log .Infof ("Received ExtContractsGroupDelete: %+v" , contractsGroup )
177
177
178
- // At this moment, we let the external contracts to be deleted only
179
- // if there are no consumers of this external contracts group
180
- if isExtContractsGroupUsed (contractsGroup ) == true {
181
- log .Errorf ("Error: External contracts groups is being used: %s" , contractsGroup .ContractsGroupName )
182
- return core .Errorf ("External contracts group is in-use" )
183
- }
178
+ // At this moment, we let the external contracts to be deleted only
179
+ // if there are no consumers of this external contracts group
180
+ if isExtContractsGroupUsed (contractsGroup ) == true {
181
+ log .Errorf ("Error: External contracts groups is being used: %s" , contractsGroup .ContractsGroupName )
182
+ return core .Errorf ("External contracts group is in-use" )
183
+ }
184
184
185
- return nil
185
+ return nil
186
186
}
0 commit comments