@@ -522,6 +522,47 @@ func TestTransparentNetworkCreationForDelegated(t *testing.T) {
522522 }
523523}
524524
525+ // Test Configure HNC network for infraNIC ensuring the hcn network type is always l2 bridge
526+ func TestConfigureHCNNetworkInfraNIC (t * testing.T ) {
527+ expectedHcnNetworkType := hcn .L2Bridge
528+
529+ nm := & networkManager {
530+ ExternalInterfaces : map [string ]* externalInterface {},
531+ }
532+
533+ extIf := externalInterface {
534+ Name : "eth0" ,
535+ }
536+
537+ nwInfo := & EndpointInfo {
538+ AdapterName : "eth0" ,
539+ NetworkID : "d3e97a83-ba4c-45d5-ba88-dc56757ece28" ,
540+ MasterIfName : "eth0" ,
541+ NICType : cns .InfraNIC ,
542+ IfIndex : 1 ,
543+ EndpointID : "753d3fb6-e9b3-49e2-a109-2acc5dda61f1" ,
544+ ContainerID : "545055c2-1462-42c8-b222-e75d0b291632" ,
545+ NetNsPath : "fakeNameSpace" ,
546+ IfName : "eth0" ,
547+ Data : make (map [string ]interface {}),
548+ EndpointDNS : DNSInfo {
549+ Suffix : "10.0.0.0" ,
550+ Servers : []string {"10.0.0.1, 10.0.0.2" },
551+ Options : nil ,
552+ },
553+ HNSNetworkID : "853d3fb6-e9b3-49e2-a109-2acc5dda61f1" ,
554+ }
555+
556+ hostComputeNetwork , err := nm .configureHcnNetwork (nwInfo , & extIf )
557+ if err != nil {
558+ t .Fatalf ("Failed to configure hcn network for infraNIC interface due to: %v" , err )
559+ }
560+
561+ if hostComputeNetwork .Type != expectedHcnNetworkType {
562+ t .Fatalf ("Host network mode is not configured as %v mode when interface NIC type is infraNIC" , expectedHcnNetworkType )
563+ }
564+ }
565+
525566// Test Configure HCN Network for Swiftv2 DelegatedNIC HostComputeNetwork fields
526567func TestConfigureHCNNetworkSwiftv2DelegatedNIC (t * testing.T ) {
527568 expectedSwiftv2NetworkMode := hcn .Transparent
0 commit comments