From 1fc90f15489ae3eafeb5994f5285f09750feae4c Mon Sep 17 00:00:00 2001 From: Eric Multanen Date: Wed, 30 Sep 2020 22:38:59 -0700 Subject: 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 Change-Id: Icadacb5ec6d7c238bb3bf8a44a39c30692ecebee --- src/ovnaction/pkg/module/chaining.go | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/ovnaction/pkg/module/chaining.go') 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, } -- cgit 1.2.3-korg