aboutsummaryrefslogtreecommitdiffstats
path: root/src/ovnaction/pkg/module/chaining.go
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-09-30 22:38:59 -0700
committerEric Multanen <eric.w.multanen@intel.com>2020-10-02 23:41:52 -0700
commit1fc90f15489ae3eafeb5994f5285f09750feae4c (patch)
treebb42ac610b2fbc13e5cfc746bb32f3b8ccabd2b3 /src/ovnaction/pkg/module/chaining.go
parentd4b89af411ec7444b554a8b0ddeb7e239fa0fc73 (diff)
Ovnaction and vfw updates for deploy api change
Update the ovnaction controller APIs to support the api change of including the deployment intent group in the URL. Also fixup: - vfw and other test cases to support the change - updates to emcoctl tool and examples Issue-ID: MULTICLOUD-1218 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: Icadacb5ec6d7c238bb3bf8a44a39c30692ecebee
Diffstat (limited to 'src/ovnaction/pkg/module/chaining.go')
-rw-r--r--src/ovnaction/pkg/module/chaining.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/ovnaction/pkg/module/chaining.go b/src/ovnaction/pkg/module/chaining.go
index 45f061fa..bc2cac00 100644
--- a/src/ovnaction/pkg/module/chaining.go
+++ b/src/ovnaction/pkg/module/chaining.go
@@ -54,6 +54,7 @@ type ChainKey struct {
Project string `json:"project"`
CompositeApp string `json:"compositeapp"`
CompositeAppVersion string `json:"compositeappversion"`
+ DigName string `json:"deploymentintentgroup"`
NetControlIntent string `json:"netcontrolintent"`
NetworkChain string `json:"networkchain"`
}
@@ -76,10 +77,10 @@ const ChainingKind = "NetworkChaining"
// ChainManager is an interface exposing the Chain functionality
type ChainManager interface {
- CreateChain(ch Chain, pr, ca, caver, netctrlint string, exists bool) (Chain, error)
- GetChain(name, pr, ca, caver, netctrlint string) (Chain, error)
- GetChains(pr, ca, caver, netctrlint string) ([]Chain, error)
- DeleteChain(name, pr, ca, caver, netctrlint string) error
+ CreateChain(ch Chain, pr, ca, caver, dig, netctrlint string, exists bool) (Chain, error)
+ GetChain(name, pr, ca, caver, dig, netctrlint string) (Chain, error)
+ GetChains(pr, ca, caver, dig, netctrlint string) ([]Chain, error)
+ DeleteChain(name, pr, ca, caver, dig, netctrlint string) error
}
// ChainClient implements the Manager
@@ -100,24 +101,25 @@ func NewChainClient() *ChainClient {
}
// CreateChain - create a new Chain
-func (v *ChainClient) CreateChain(ch Chain, pr, ca, caver, netctrlint string, exists bool) (Chain, error) {
+func (v *ChainClient) CreateChain(ch Chain, pr, ca, caver, dig, netctrlint string, exists bool) (Chain, error) {
//Construct key and tag to select the entry
key := ChainKey{
Project: pr,
CompositeApp: ca,
CompositeAppVersion: caver,
+ DigName: dig,
NetControlIntent: netctrlint,
NetworkChain: ch.Metadata.Name,
}
//Check if the Network Control Intent exists
- _, err := NewNetControlIntentClient().GetNetControlIntent(netctrlint, pr, ca, caver)
+ _, err := NewNetControlIntentClient().GetNetControlIntent(netctrlint, pr, ca, caver, dig)
if err != nil {
return Chain{}, pkgerrors.Errorf("Network Control Intent %v does not exist", netctrlint)
}
//Check if this Chain already exists
- _, err = v.GetChain(ch.Metadata.Name, pr, ca, caver, netctrlint)
+ _, err = v.GetChain(ch.Metadata.Name, pr, ca, caver, dig, netctrlint)
if err == nil && !exists {
return Chain{}, pkgerrors.New("Chain already exists")
}
@@ -131,12 +133,13 @@ func (v *ChainClient) CreateChain(ch Chain, pr, ca, caver, netctrlint string, ex
}
// GetChain returns the Chain for corresponding name
-func (v *ChainClient) GetChain(name, pr, ca, caver, netctrlint string) (Chain, error) {
+func (v *ChainClient) GetChain(name, pr, ca, caver, dig, netctrlint string) (Chain, error) {
//Construct key and tag to select the entry
key := ChainKey{
Project: pr,
CompositeApp: ca,
CompositeAppVersion: caver,
+ DigName: dig,
NetControlIntent: netctrlint,
NetworkChain: name,
}
@@ -160,12 +163,13 @@ func (v *ChainClient) GetChain(name, pr, ca, caver, netctrlint string) (Chain, e
}
// GetChains returns all of the Chains for for the given network control intent
-func (v *ChainClient) GetChains(pr, ca, caver, netctrlint string) ([]Chain, error) {
+func (v *ChainClient) GetChains(pr, ca, caver, dig, netctrlint string) ([]Chain, error) {
//Construct key and tag to select the entry
key := ChainKey{
Project: pr,
CompositeApp: ca,
CompositeAppVersion: caver,
+ DigName: dig,
NetControlIntent: netctrlint,
NetworkChain: "",
}
@@ -189,13 +193,14 @@ func (v *ChainClient) GetChains(pr, ca, caver, netctrlint string) ([]Chain, erro
}
// DeleteChain deletes the Chain from the database
-func (v *ChainClient) DeleteChain(name, pr, ca, caver, netctrlint string) error {
+func (v *ChainClient) DeleteChain(name, pr, ca, caver, dig, netctrlint string) error {
//Construct key and tag to select the entry
key := ChainKey{
Project: pr,
CompositeApp: ca,
CompositeAppVersion: caver,
+ DigName: dig,
NetControlIntent: netctrlint,
NetworkChain: name,
}