1、network 部分

// Package networks contains functionality for working with Neutron network resources.

// A network is an isolated virtual lay-2 broadcast domain that is typically reserved for

// the tenant who created it (unless you configure the network to be shared). Tenants

// can create multiple networks until the thresholds per-tenant quota is reached

//

// In the v2.0 Networking API, the network is the main entity. Ports and subnets are

// always associated with a networ

// networking/v2/networks/requests.go

// Create accepts a CreateOpts struct and creates a new network using the values

// provided. This operation does not actually require a request body , i.e. the

// CreateOpts struct argument can be empty.

//

// The tenant ID that is containd in the URI is the tenant that creates the network.

// An admin user, however, has the option of specifying another tenant ID in the

// CreateOpts struct.

1、func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) 

1、首先调用b, err := opts.ToNetworkCreateMap(),将CreateOpts结构转换为一个map

2、调用_, r.Err = c.Post(createURL(c), b, &r.Body, nil)

CreateOpts结构如下所示:

type CreateOpts struct {

  AdminStateUp    *bool

  Name         string

  Shared        *bool

  TenantID       string

}

2、router部分

// networking/v2/extensions/layer3/routers/requests.go

// Create accepts a CreateOpts struct and uses the values to create a new

// logical router. When it is created, the router does not have an inernal interface -

// it is not associated to any subnet.

//

// You can optionally specify an external gateway for a router using the

// GatewayInfo struct. The external gateway for the router must be plugged into

// an external network (it is external if its `router:external` field is set to true)

func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

// networking/v2/extensions/layer3/routers/requests.go

// AddInterface attaches a subnet to an internal router interface. You must specify

// either a SubnetID or PortID in the request body. If you specify both, the operation

// will fail and an error will be returned

//

// If you specify a SubnetID, the gateway IP address for that particular subnet is

// used to create the router interface. Alternatively, if you specify a PortID, the IP

// address associated with the port is used to create the router interface.

//

// If you reference a port that is associated with multiple IP addresses, or if the port

// is associated with zero IP addresses, the operation will fail and a 400 Bad Request

// error will be returned.

//

// If you reference a port already in use, the operation will fail and a 409 Conflict

// error will be returned.

//

// The PortID that is returned using Extract() on the result of this operation can

// either be the same PortID passed in or, on the other hand, the identifier of a new

// port created by this operation. After the operation completes, the device ID of the

// port is set to the router ID, and the device owner attribute is set to

// `network:router_interface`.

func AddInterface(c *gophercloud.ServiceClient, id string, opts AddInterfaceOptsBuilder) (r InterfaceResult)

3、subnet部分

// Package subnets containsj functionality for working with Neutron subnet resources

// A subnet represents an IP address block that can be used to assign IP addresses

// to virtual instances. Each subnet must have a CIDR and must be associated with a

// network. IPs can either be selected from the whole subnet CIDR or from allocation

// pools specified by the user.

//

// A subnet can also have a gateway, a list of DNS name servers, and host routes.

// This information is pushed to instances whose interfaces are associated with the

// subnet

// networking/v2/subnets/requests.go

// Create accepts a CreateOpts struct and creates a new subnet using the values

// provided. You must remember to provide a valid NetworkID, CIDR and IP Version.

func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

4、port部分

// Package ports contains functionality for working with Neutron port resources.

// A port represents a virtual switch port on a logical network switch. Virtual

// instances attach theri interfaces into ports. The logical port also defines the MAC

// address and the IP address(es) to be assigned to the interfaces plugged into them

// When IP addresses are associated to a port, this is also implies the port is

// associated with a subnet, as the IP address was taken from the allocation pool for

// a specific subnet.

gophercloud openstack networking 源码分析的更多相关文章

  1. Openstack Nova 源码分析 — 使用 VCDriver 创建 VMware Instance

    目录 目录 前言 流程图 nova-compute vCenter 前言 在上一篇Openstack Nova 源码分析 - Create instances (nova-conductor阶段)中, ...

  2. Openstack nova-scheduler 源码分析 — Filters/Weighting

    目录 目录 前言 调度器 FilterScheduler调度器的工作流程 Filters 过滤器 Filters 类型 Weighting 权重 源码实现 关键文件及其意义 阶段一nova-sched ...

  3. Openstack Nova 源码分析 — RPC 远程调用过程

    目录 目录 Nova Project Services Project 的程序入口 setuppy Nova中RPC远程过程调用 nova-compute RPC API的实现 novacompute ...

  4. Openstack Nova 源码分析 — Create instances (nova-conductor阶段)

    目录 目录 前言 Instance Flavor Instance Status Virt Driver Resource Tracker nova-conductor Create Instance ...

  5. 转:[gevent源码分析] 深度分析gevent运行流程

    [gevent源码分析] 深度分析gevent运行流程 http://blog.csdn.net/yueguanghaidao/article/details/24281751 一直对gevent运行 ...

  6. keystone源码分析(一)——Paste Deploy的应用

    本keystone源码分析系列基于Juno版Keystone,于2014年10月16日随Juno版OpenStack发布. Keystone作为OpenStack中的身份管理与授权模块,主要实现系统用 ...

  7. ceilometer 源码分析(polling)(O版)

    一.简单介绍ceilometer 这里长话短说, ceilometer是用来采集openstack下面各种资源的在某一时刻的资源值,比如云硬盘的大小等.下面是官网现在的架构图 这里除了ceilomet ...

  8. Docker源码分析(八):Docker Container网络(下)

    1.Docker Client配置容器网络模式 Docker目前支持4种网络模式,分别是bridge.host.container.none,Docker开发者可以根据自己的需求来确定最适合自己应用场 ...

  9. Docker源码分析(六):Docker Daemon网络

    1. 前言 Docker作为一个开源的轻量级虚拟化容器引擎技术,已然给云计算领域带来了新的发展模式.Docker借助容器技术彻底释放了轻量级虚拟化技术的威力,让容器的伸缩.应用的运行都变得前所未有的方 ...

随机推荐

  1. WebApi接口安全认证——HTTP之摘要认证

    摘要访问认证是一种协议规定的Web服务器用来同网页浏览器进行认证信息协商的方法.它在密码发出前,先对其应用哈希函数,这相对于HTTP基本认证发送明文而言,更安全.从技术上讲,摘要认证是使用随机数来阻止 ...

  2. Javascript网页截屏的方法

    最近我在研究开发一个火狐插件,具体的功能是将网页内容截屏并分享到微博上.目前基本功能已经实现,大家可以在 @程序师视野 里看到用这个截图插件分享的微博的效果. 之前我曾写过如何将canvas图形转换成 ...

  3. 老司机的应用级监控——spring?actuator

    http://mt.sohu.com/20160824/n465783118.shtml ************************************************ 1什么是sp ...

  4. 微信中调起qq

    http://wpa.qq.com/msgrd?uin={$qq}&menu=yes

  5. SAML2.0 协议初识(三)——IDP

    IDP,即提供身份认证服务的一端,通常,当 IDP 接收到 SP 发送的 SAML 认证请求后,解析 SAMLRequest 参数,包括 acs 地址.SP EntityId.绑定方式.是否加密等信息 ...

  6. 由Python的一个小例子想到的

    习题: L = [1,2] L.append(L) Print L 问,结果是什么. 结果是,[1,2,[...]] 这是什么意思呢?就是说[...]表示的对[1,2]的无限循环.这一点是在C#等静态 ...

  7. jmeter插件JMeterPlugins-Standard 压力测试

    Jmeter有插件提供用来给用户监控所测试的服务器的资源使用 情况,需要有Jmeter客户端插件和服务端插件 1.客户端插件 需要在https://jmeter-plugins.org/downloa ...

  8. React从入门到精通系列之(14)refs和DOM元素

    react.js 3.7k 次阅读  ·  读完需要 8 分钟 8 十四.refs和DOM元素 在典型的React数据流中,props是父组件与其子组件交互的唯一方式. 要修改子组件,需要使用一个新的 ...

  9. 第一百三十九节,JavaScript,封装库--CSS选择器

    JavaScript,封装库--修改元素选择器 就是将构造库函数修改成元素选择器,像css那样,输入#xxx .xxx xxx  (获取指定id下的指定class下的指定标签元素) 修改后的基础库 / ...

  10. 【BZOJ】2020: [Usaco2010 Jan]Buying Feed, II (dp)

    http://www.lydsy.com/JudgeOnline/problem.php?id=2020 和背包差不多 同样滚动数组 f[j]表示当前位置j份食物的最小价值 f[j]=min(f[j- ...