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. JVM-String常量池与运行时常量池

    Start with JVM 周志明先生著-<深入理解Java虚拟机>,书买回来好几天了,但是最近才准备开始搞一搞了(哭瞎…..).首先是第一章的Java以及JVM发展历史,大概知道了现行 ...

  2. Vue 混合

    混合(mixins)是一种分发vue组件中可复用功能的非常灵活的方式.混合对象可以可以包含任意组件选项.以组件使用混合对象时,所有混合对象的选项将被混合到该组件本身的选项. //定义一个混合对象 va ...

  3. pycharm 社区版

    这个是免费版.到3.1.13 http://pan.baidu.com/s/1bnvPdtt 没用过idea的商业版,不知道为什么它的更新那么蛋疼,不能增量更新,每次都得手动下载完整的压缩包.

  4. Android Studio无法启动,gradle下载不了 提示“building “ 项目名”gradle project info”

    Google在2013年I/O大会上发布了Android Studio,AndroidStudio是一个基于IntelliJ思想的新的Android开发工具.下面介绍一下Android Studio安 ...

  5. A protocol error occurred. Change of username or service not allowed: (root,ssh-connection) -> (zoujiaqing,ssh-connection)

    SecureCRT ssh 客户端连接失败: The server has disconnected with an error.  Server message reads: A protocol ...

  6. 【iOS与EV3混合机器人编程系列之四】iOS_WiFi_EV3_Library 剖析之中的一个:WiFi UDP和TCP

    在上一篇文章中.我们通过编写EV3 Port Viewer项目实现了iOS监測EV3的实时端口数据. 程序最核心的部分就是我们的开源码库iOS_WiFi_EV3_Library. 那么,在本文中,我们 ...

  7. JDK8集合的便捷操作

    JDK8新特性,stream相关操作.把集合转换成stream,再对其进行相关操作,加上lambada表达式. demo: List<String> list = Arrays.asLis ...

  8. 【转】【Mac + Git】之Git pull 强制拉取并覆盖本地代码

    Git pull 强制拉取并覆盖本地代码 git fetch --all git reset --hard origin/master git pull 参考文章: <Git pull 强制拉取 ...

  9. idea编译修改jdk版本

    由于项目需要,需要修改jdk的版本为1.8,这里记录一下修改的地方 1,项目的jdk版本 右键点击项目-> open module setting ->project,然后如图所示 2,在 ...

  10. 什么是 Web?

    Web这个词刚开始显得有些泛泛,似乎“冲浪”.“网上存在”以及“主页”等等都和它拉上了一些关系. 甚至还有一种“Internet 综合症”的说法,对许多人狂热的上网行为提出了质疑.我们在这里有必要作一 ...