Skip to content

Commit

Permalink
[minor_change] Add DNs of port, pcPort, associated groups and associa…
Browse files Browse the repository at this point in the history
…ted sub groups attributes to infraPortConfig and fabricPortConfig (#275)
  • Loading branch information
shrsr authored Jul 18, 2023
1 parent 8ceaf71 commit ac4d6e8
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 42 deletions.
42 changes: 24 additions & 18 deletions models/fabric_port_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ type FabricPortConfiguration struct {
}

type FabricPortConfigurationAttributes struct {
Annotation string `json:",omitempty"`
AssocGrp string `json:",omitempty"`
Card string `json:",omitempty"`
Descr string `json:",omitempty"`
Node string `json:",omitempty"`
Port string `json:",omitempty"`
Role string `json:",omitempty"`
Shutdown string `json:",omitempty"`
SubPort string `json:",omitempty"`
Annotation string `json:",omitempty"`
AssocGrp string `json:",omitempty"`
Card string `json:",omitempty"`
Descr string `json:",omitempty"`
Node string `json:",omitempty"`
Port string `json:",omitempty"`
Role string `json:",omitempty"`
Shutdown string `json:",omitempty"`
SubPort string `json:",omitempty"`
OperationalAssocGrp string `json:",omitempty"`
PortDn string `json:",omitempty"`
}

func NewFabricPortConfiguration(fabricPortConfigRn, parentDn, description string, fabricPortConfigAttr FabricPortConfigurationAttributes) *FabricPortConfiguration {
Expand Down Expand Up @@ -59,6 +61,8 @@ func (fabricPortConfig *FabricPortConfiguration) ToMap() (map[string]string, err
A(fabricPortConfigMap, "role", fabricPortConfig.Role)
A(fabricPortConfigMap, "shutdown", fabricPortConfig.Shutdown)
A(fabricPortConfigMap, "subPort", fabricPortConfig.SubPort)
A(fabricPortConfigMap, "operationalAssocGrp", fabricPortConfig.OperationalAssocGrp)
A(fabricPortConfigMap, "portDn", fabricPortConfig.PortDn)
return fabricPortConfigMap, err
}

Expand All @@ -72,15 +76,17 @@ func FabricPortConfigurationFromContainerList(cont *container.Container, index i
Rn: G(FabricPortConfigurationCont, "rn"),
},
FabricPortConfigurationAttributes{
Annotation: G(FabricPortConfigurationCont, "annotation"),
AssocGrp: G(FabricPortConfigurationCont, "assocGrp"),
Card: G(FabricPortConfigurationCont, "card"),
Descr: G(FabricPortConfigurationCont, "description"),
Node: G(FabricPortConfigurationCont, "node"),
Port: G(FabricPortConfigurationCont, "port"),
Role: G(FabricPortConfigurationCont, "role"),
Shutdown: G(FabricPortConfigurationCont, "shutdown"),
SubPort: G(FabricPortConfigurationCont, "subPort"),
Annotation: G(FabricPortConfigurationCont, "annotation"),
AssocGrp: G(FabricPortConfigurationCont, "assocGrp"),
Card: G(FabricPortConfigurationCont, "card"),
Descr: G(FabricPortConfigurationCont, "description"),
Node: G(FabricPortConfigurationCont, "node"),
Port: G(FabricPortConfigurationCont, "port"),
Role: G(FabricPortConfigurationCont, "role"),
Shutdown: G(FabricPortConfigurationCont, "shutdown"),
SubPort: G(FabricPortConfigurationCont, "subPort"),
OperationalAssocGrp: G(FabricPortConfigurationCont, "operationalAssocGrp"),
PortDn: G(FabricPortConfigurationCont, "portDn"),
},
}
}
Expand Down
60 changes: 36 additions & 24 deletions models/infra_port_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ type InfraPortConfiguration struct {
}

type InfraPortConfigurationAttributes struct {
Annotation string `json:",omitempty"`
AssocGrp string `json:",omitempty"`
BrkoutMap string `json:",omitempty"`
Card string `json:",omitempty"`
ConnectedFex string `json:",omitempty"`
Descr string `json:",omitempty"`
Node string `json:",omitempty"`
PcMember string `json:",omitempty"`
Port string `json:",omitempty"`
Role string `json:",omitempty"`
Shutdown string `json:",omitempty"`
SubPort string `json:",omitempty"`
Annotation string `json:",omitempty"`
AssocGrp string `json:",omitempty"`
BrkoutMap string `json:",omitempty"`
Card string `json:",omitempty"`
ConnectedFex string `json:",omitempty"`
Descr string `json:",omitempty"`
Node string `json:",omitempty"`
PcMember string `json:",omitempty"`
Port string `json:",omitempty"`
Role string `json:",omitempty"`
Shutdown string `json:",omitempty"`
SubPort string `json:",omitempty"`
OperationalAssocGrp string `json:",omitempty"`
OperationalAssocSubGrp string `json:",omitempty"`
PortDn string `json:",omitempty"`
PcPortDn string `json:",omitempty"`
}

func NewInfraPortConfiguration(infraPortConfigRn, parentDn, description string, infraPortConfigAttr InfraPortConfigurationAttributes) *InfraPortConfiguration {
Expand Down Expand Up @@ -65,6 +69,10 @@ func (infraPortConfig *InfraPortConfiguration) ToMap() (map[string]string, error
A(infraPortConfigMap, "role", infraPortConfig.Role)
A(infraPortConfigMap, "shutdown", infraPortConfig.Shutdown)
A(infraPortConfigMap, "subPort", infraPortConfig.SubPort)
A(infraPortConfigMap, "operationalAssocGrp", infraPortConfig.OperationalAssocGrp)
A(infraPortConfigMap, "operationalAssocSubGrp", infraPortConfig.OperationalAssocSubGrp)
A(infraPortConfigMap, "portDn", infraPortConfig.PortDn)
A(infraPortConfigMap, "pcPortDn", infraPortConfig.PcPortDn)

if infraPortConfig.BrkoutMap != "" && infraPortConfig.BrkoutMap != "none" {
infraPortConfigMap["assocGrp"] = ""
Expand All @@ -83,18 +91,22 @@ func InfraPortConfigurationFromContainerList(cont *container.Container, index in
Rn: G(InfraPortConfigurationCont, "rn"),
},
InfraPortConfigurationAttributes{
Annotation: G(InfraPortConfigurationCont, "annotation"),
AssocGrp: G(InfraPortConfigurationCont, "assocGrp"),
BrkoutMap: G(InfraPortConfigurationCont, "brkoutMap"),
Card: G(InfraPortConfigurationCont, "card"),
ConnectedFex: G(InfraPortConfigurationCont, "connectedFex"),
Descr: G(InfraPortConfigurationCont, "description"),
Node: G(InfraPortConfigurationCont, "node"),
PcMember: G(InfraPortConfigurationCont, "pcMember"),
Port: G(InfraPortConfigurationCont, "port"),
Role: G(InfraPortConfigurationCont, "role"),
Shutdown: G(InfraPortConfigurationCont, "shutdown"),
SubPort: G(InfraPortConfigurationCont, "subPort"),
Annotation: G(InfraPortConfigurationCont, "annotation"),
AssocGrp: G(InfraPortConfigurationCont, "assocGrp"),
BrkoutMap: G(InfraPortConfigurationCont, "brkoutMap"),
Card: G(InfraPortConfigurationCont, "card"),
ConnectedFex: G(InfraPortConfigurationCont, "connectedFex"),
Descr: G(InfraPortConfigurationCont, "description"),
Node: G(InfraPortConfigurationCont, "node"),
PcMember: G(InfraPortConfigurationCont, "pcMember"),
Port: G(InfraPortConfigurationCont, "port"),
Role: G(InfraPortConfigurationCont, "role"),
Shutdown: G(InfraPortConfigurationCont, "shutdown"),
SubPort: G(InfraPortConfigurationCont, "subPort"),
OperationalAssocGrp: G(InfraPortConfigurationCont, "operationalAssocGrp"),
OperationalAssocSubGrp: G(InfraPortConfigurationCont, "operationalAssocSubGrp"),
PortDn: G(InfraPortConfigurationCont, "portDn"),
PcPortDn: G(InfraPortConfigurationCont, "pcPortDn"),
},
}
}
Expand Down

0 comments on commit ac4d6e8

Please sign in to comment.