import ( "fmt" "github.com/juniper/contrail-go-api/types" ) // Create a new virtual network object vn := types.VirtualNetwork { DisplayName: "My Virtual Network", AddressAllocationMode: "user-defined-subnet-only", } // Print out the name and UUID of the new network fmt.Println(vn.DisplayName) fmt.Println(vn.UUID)
import ( "fmt" "github.com/juniper/contrail-go-api/types" ) // Create a new virtual network object vn := types.VirtualNetwork { DisplayName: "My Virtual Network", AddressAllocationMode: "user-defined-subnet-only", } // Set the IP address range for the network vn.Subnets = []types.SubnetType{ { SubnetPrefix: "192.168.0.0", SubnetPrefixLen: 24, }, } // Print out the IP address range for the network fmt.Println(vn.Subnets[0].SubnetPrefix) fmt.Println(vn.Subnets[0].SubnetPrefixLen)This example creates a new virtual network object, sets the display name and address allocation mode, and then sets the IP address range for the network. It then prints out the IP address range for the network.