[VOL-4762] Workaround for govet json Marshal issue
Change-Id: I407886340bdc5f01d46327e989d4229d27943c30
diff --git a/Makefile b/Makefile
index c79c276..dbda623 100644
--- a/Makefile
+++ b/Makefile
@@ -78,8 +78,12 @@
sudo docker build -t $(IMAGENAME)-profile -f docker/Dockerfile.voltha-go-controller .
sca: ## Runs static code analysis with the golangci-lint tool
+ @rm -rf ./sca-report
+ @mkdir -p ./sca-report
@echo "Running static code analysis..."
- sudo docker run --rm --user $$(id -u):$$(id -g) -v $(CURDIR):/go/src ciena/go-lint
+ @${GOLANGCI_LINT} run -vv --deadline=6m --out-format junit-xml ./... | tee ./sca-report/sca-report.xml
+ @echo ""
+ @echo "Static code analysis OK"
clean: ## Removes any local filesystem artifacts generated by a build
rm -f voltha-go-controller/voltha-go-controller
diff --git a/internal/pkg/application/igmp.go b/internal/pkg/application/igmp.go
index fa28c8e..d43283d 100644
--- a/internal/pkg/application/igmp.go
+++ b/internal/pkg/application/igmp.go
@@ -5273,3 +5273,22 @@
}
return true
}
+
+// JsonMarshal wrapper function for json Marshal MvlanProfile
+func (mvp *MvlanProfile) JsonMarshal() ([]byte, error) {
+ return json.Marshal(MvlanProfile{
+ Name: mvp.Name,
+ Mvlan: mvp.Mvlan,
+ PonVlan: mvp.PonVlan,
+ Groups: mvp.Groups,
+ Proxy: mvp.Proxy,
+ Version: mvp.Version,
+ IsPonVlanPresent: mvp.IsPonVlanPresent,
+ IsChannelBasedGroup: mvp.IsChannelBasedGroup,
+ DevicesList: mvp.DevicesList,
+ MaxActiveChannels: mvp.MaxActiveChannels,
+ PendingDeleteFlow: mvp.PendingDeleteFlow,
+ DeleteInProgress: mvp.DeleteInProgress,
+ IgmpServVersion: mvp.IgmpServVersion,
+ })
+}
diff --git a/internal/pkg/application/major_upgrade.go b/internal/pkg/application/major_upgrade.go
index 13c3762..084a554 100644
--- a/internal/pkg/application/major_upgrade.go
+++ b/internal/pkg/application/major_upgrade.go
@@ -347,7 +347,7 @@
vs.AssociatedFlows = make(map[string]bool)
vs.DeleteInProgress = false
vs.PonPort = 0xFF
- if updatedData, err = json.Marshal(vs); err != nil {
+ if updatedData, err = vs.JsonMarshal(); err != nil {
logger.Warnw(ctx, "Marshal of Service failed", log.Fields{"Error": err.Error()})
return ""
}
@@ -414,7 +414,7 @@
}
vnet.PendingDeleteFlow = make(map[string]map[string]bool)
vnet.DeleteInProgress = false
- if updatedData, err = json.Marshal(vnet); err != nil {
+ if updatedData, err = vnet.JsonMarshal(); err != nil {
logger.Warnw(ctx, "Marshal of Vnet failed", log.Fields{"Error": err.Error()})
return ""
}
@@ -469,7 +469,7 @@
vpv.PendingDeleteFlow = make(map[string]bool)
vpv.PonPort = 0xFF
- if updatedData, err = json.Marshal(vpv); err != nil {
+ if updatedData, err = vpv.JsonMarshal(); err != nil {
logger.Warnw(ctx, "Marshal of VPV failed", log.Fields{"Error": err.Error()})
return ""
}
@@ -495,7 +495,7 @@
mvp.IgmpServVersion[srNo] = &servVersion
}
- if updatedData, err = json.Marshal(mvp); err != nil {
+ if updatedData, err = mvp.JsonMarshal(); err != nil {
logger.Warnw(ctx, "Marshal of Mvlan Profile failed", log.Fields{"Error": err.Error()})
return ""
}
diff --git a/internal/pkg/application/service.go b/internal/pkg/application/service.go
index e90b948..e9a7393 100644
--- a/internal/pkg/application/service.go
+++ b/internal/pkg/application/service.go
@@ -1976,3 +1976,31 @@
//triggerServiceInProgressInd - Indication is generated when Service is not provisioned after add serviec req from NB
func (vs *VoltService) triggerServiceInProgressInd() {
}
+
+// JsonMarshal wrapper function for json Marshal VoltService
+func (vs *VoltService) JsonMarshal() ([]byte, error) {
+ return json.Marshal(VoltService{
+ VoltServiceCfg: vs.VoltServiceCfg,
+ VoltServiceOper: VoltServiceOper{
+ Device: vs.VoltServiceOper.Device,
+ Ipv4Addr: vs.VoltServiceOper.Ipv4Addr,
+ Ipv6Addr: vs.VoltServiceOper.Ipv6Addr,
+ UsMeterID: vs.VoltServiceOper.UsMeterID,
+ DsMeterID: vs.VoltServiceOper.DsMeterID,
+ AggDsMeterID: vs.VoltServiceOper.AggDsMeterID,
+ UsHSIAFlowsApplied: vs.VoltServiceOper.UsHSIAFlowsApplied,
+ DsHSIAFlowsApplied: vs.VoltServiceOper.DsHSIAFlowsApplied,
+ UsDhcpFlowsApplied: vs.VoltServiceOper.UsDhcpFlowsApplied,
+ DsDhcpFlowsApplied: vs.VoltServiceOper.DsDhcpFlowsApplied,
+ IgmpFlowsApplied: vs.VoltServiceOper.IgmpFlowsApplied,
+ Icmpv6FlowsApplied: vs.VoltServiceOper.Icmpv6FlowsApplied,
+ PendingFlows: vs.VoltServiceOper.PendingFlows,
+ AssociatedFlows: vs.VoltServiceOper.AssociatedFlows,
+ DeleteInProgress: vs.VoltServiceOper.DeleteInProgress,
+ ForceDelete: vs.VoltServiceOper.ForceDelete,
+ BwAvailInfo: vs.VoltServiceOper.BwAvailInfo,
+ UpdateInProgress: vs.VoltServiceOper.UpdateInProgress,
+ Metadata: vs.VoltServiceOper.Metadata,
+ },
+ })
+}
diff --git a/internal/pkg/application/vnets.go b/internal/pkg/application/vnets.go
index cf2d1fc..40add28 100644
--- a/internal/pkg/application/vnets.go
+++ b/internal/pkg/application/vnets.go
@@ -3136,3 +3136,65 @@
}
return true
}
+
+// JsonMarshal wrapper function for json Marshal VoltVnet
+func (vv *VoltVnet) JsonMarshal() ([]byte, error) {
+ return json.Marshal(VoltVnet{
+ VnetConfig: vv.VnetConfig,
+ Version: vv.Version,
+ VnetOper: VnetOper{
+ PendingDeleteFlow: vv.VnetOper.PendingDeleteFlow,
+ DeleteInProgress: vv.VnetOper.DeleteInProgress,
+ PendingDeviceToDelete: vv.VnetOper.PendingDeviceToDelete,
+ },
+ })
+}
+
+// JsonMarshal wrapper function for json Marshal VoltPortVnet
+func (vpv *VoltPortVnet) JsonMarshal() ([]byte, error) {
+ return json.Marshal(VoltPortVnet{
+ Device: vpv.Device,
+ Port: vpv.Port,
+ PonPort: vpv.PonPort,
+ VnetName: vpv.VnetName,
+ SVlan: vpv.SVlan,
+ CVlan: vpv.CVlan,
+ UniVlan: vpv.UniVlan,
+ SVlanTpid: vpv.SVlanTpid,
+ DhcpRelay: vpv.DhcpRelay,
+ ArpRelay: vpv.ArpRelay,
+ PppoeIa: vpv.PppoeIa,
+ MacLearning: vpv.MacLearning,
+ DhcpStatus: vpv.DhcpStatus,
+ DhcpExpiryTime: vpv.DhcpExpiryTime,
+ Dhcp6ExpiryTime: vpv.Dhcp6ExpiryTime,
+ FlowsApplied: vpv.FlowsApplied,
+ Ipv4Addr: vpv.Ipv4Addr,
+ Ipv6Addr: vpv.Ipv6Addr,
+ MacAddr: vpv.MacAddr,
+ LearntMacAddr: vpv.LearntMacAddr,
+ CircuitID: vpv.CircuitID,
+ RemoteID: vpv.RemoteID,
+ IsOption82Disabled: vpv.IsOption82Disabled,
+ RelayState: vpv.RelayState,
+ PPPoeState: vpv.PPPoeState,
+ RelayStatev6: vpv.RelayStatev6,
+ IgmpEnabled: vpv.IgmpEnabled,
+ IgmpFlowsApplied: vpv.IgmpFlowsApplied,
+ McastService: vpv.McastService,
+ ONTEtherTypeClassification: vpv.ONTEtherTypeClassification,
+ VlanControl: vpv.VlanControl,
+ MvlanProfileName: vpv.MvlanProfileName,
+ Version: vpv.Version,
+ McastTechProfileID: vpv.McastTechProfileID,
+ McastPbit: vpv.McastPbit,
+ McastUsMeterID: vpv.McastUsMeterID,
+ AllowTransparent: vpv.AllowTransparent,
+ SchedID: vpv.SchedID,
+ DHCPv6DUID: vpv.DHCPv6DUID,
+ PendingDeleteFlow: vpv.PendingDeleteFlow,
+ DeleteInProgress: vpv.DeleteInProgress,
+ Blocked: vpv.Blocked,
+ DhcpPbit: vpv.DhcpPbit,
+ })
+}