github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/provider/doc.go (about)

     1  /*
     2  Package provider gives access to the provider Neutron plugin, allowing
     3  network extended attributes. The provider extended attributes for networks
     4  enable administrative users to specify how network objects map to the
     5  underlying networking infrastructure. These extended attributes also appear
     6  when administrative users query networks.
     7  
     8  For more information about extended attributes, see the NetworkExtAttrs
     9  struct. The actual semantics of these attributes depend on the technology
    10  back end of the particular plug-in. See the plug-in documentation and the
    11  OpenStack Cloud Administrator Guide to understand which values should be
    12  specific for each of these attributes when OpenStack Networking is deployed
    13  with a particular plug-in. The examples shown in this chapter refer to the
    14  Open vSwitch plug-in.
    15  
    16  The default policy settings enable only users with administrative rights to
    17  specify these parameters in requests and to see their values in responses. By
    18  default, the provider network extension attributes are completely hidden from
    19  regular tenants. As a rule of thumb, if these attributes are not visible in a
    20  GET /networks/<network-id> operation, this implies the user submitting the
    21  request is not authorized to view or manipulate provider network attributes.
    22  
    23  Example to List Networks with Provider Information
    24  
    25  	type NetworkWithProvider {
    26  		networks.Network
    27  		provider.NetworkProviderExt
    28  	}
    29  
    30  	var allNetworks []NetworkWithProvider
    31  
    32  	allPages, err := networks.List(networkClient, nil).AllPages()
    33  	if err != nil {
    34  		panic(err)
    35  	}
    36  
    37  	err = networks.ExtractNetworksInto(allPages, &allNetworks)
    38  	if err != nil {
    39  		panic(err)
    40  	}
    41  
    42  	for _, network := range allNetworks {
    43  		fmt.Printf("%+v\n", network)
    44  	}
    45  
    46  Example to Create a Provider Network
    47  
    48  	segments := []provider.Segment{
    49  		provider.Segment{
    50  			NetworkType:     "vxlan",
    51  			PhysicalNetwork: "br-ex",
    52  			SegmentationID:  615,
    53  		},
    54  	}
    55  
    56  	iTrue := true
    57  	networkCreateOpts := networks.CreateOpts{
    58  		Name:         "provider-network",
    59  		AdminStateUp: &iTrue,
    60  		Shared:       &iTrue,
    61  	}
    62  
    63  	createOpts : provider.CreateOptsExt{
    64  		CreateOptsBuilder: networkCreateOpts,
    65  		Segments:          segments,
    66  	}
    67  
    68  	network, err := networks.Create(networkClient, createOpts).Extract()
    69  	if err != nil {
    70  		panic(err)
    71  	}
    72  */
    73  package provider