Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vmware): change vNic name to vNIC to make netbox-ssot compatible … #506

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions internal/source/common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ func MatchVlanToGroup(
vlanGroupSiteRelations map[string]string,
) (*objects.VlanGroup, error) {
if vlanGroupRelations == nil {
vlanGroup, _ := nbi.CreateDefaultVlanGroupForVlan(ctx, vlanSite)
vlanGroup, err := nbi.CreateDefaultVlanGroupForVlan(ctx, vlanSite)
if err != nil {
return nil, fmt.Errorf("create default vlan group for vlan %s: %s", vlanName, err)
}
return vlanGroup, nil
}
vlanGroupName, err := utils.MatchStringToValue(vlanName, vlanGroupRelations)
Expand All @@ -111,7 +114,7 @@ func MatchVlanToGroup(
}
}
}
var vlanGroup *objects.VlanGroup

if vlanGroupName != "" {
vlanGroup := &objects.VlanGroup{
Name: vlanGroupName,
Expand All @@ -128,6 +131,12 @@ func MatchVlanToGroup(
}
return vlanGroup, nil
}

// No vlan group was matched create default one.
vlanGroup, err := nbi.CreateDefaultVlanGroupForVlan(ctx, vlanSite)
if err != nil {
return nil, fmt.Errorf("create default vlan group for vlan %s: %s", vlanName, err)
}
return vlanGroup, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/source/vmware/vmware_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ func (vc *VmwareSource) collectVMInterfaceData(
var vlanDescription string
intLabel := intDeviceInfo.GetDescription().Label
splitStr := strings.Split(intLabel, " ")
intName := fmt.Sprintf("vNic %s", splitStr[len(splitStr)-1])
intName := fmt.Sprintf("vNIC %s", splitStr[len(splitStr)-1])
intFullName := intName
if intNetworkName != "" {
intFullName = fmt.Sprintf("%s (%s)", intFullName, intNetworkName)
Expand Down
Loading