controllers

package
v0.0.0-...-9649b88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 28 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CtxTimeout = 4 * time.Minute // etcd timeout
)
View Source
const DefaultNetworkName string = "net_api"

Variables

View Source
var UnmarshalIPGroupReq = func(value []byte) (*EncapIPGroupReq, error) {
	var ig EncapIPGroupReq
	err := json.Unmarshal([]byte(value), &ig)
	if err != nil {
		klog.Errorf("UnmarshalIPGroupReq: json.Unmarshal(%s) FAILED, error: %v", string(value), err)
		return nil, errobj.ErrUnmarshalFailed
	}

	klog.Debugf("UnmarshalIPGroupReq: ig[%v] SUCC", ig)
	return &ig, nil
}

Functions

func CreateDefaultNetwork

func CreateDefaultNetwork() error

todo refactor

func CreatePortProcess

func CreatePortProcess(pc *CniMasterPortController, reqObj models.CreatePortReq)

func CreatePortRequestProcess

func CreatePortRequestProcess(pc *CniMasterPortController, tranID models.TranID, body []byte)

func Err400

func Err400(o *beego.Controller, err error)

func Err500

func Err500(o *beego.Controller, err error)

func ErrorRequstRsp400

func ErrorRequstRsp400(o *beego.Controller, body string)

func GetNetworkByName

func GetNetworkByName(o *beego.Controller)

func HandleErr

func HandleErr(o *beego.Controller, err error)

func HandleErr406

func HandleErr406(o *beego.Controller, err error)

func IsUUID

func IsUUID(str string) bool

func NotfoundErr404

func NotfoundErr404(o *beego.Controller, err error)

func RecoverRsp401

func RecoverRsp401(o *beego.Controller)

func RecoverRsp500

func RecoverRsp500(o *beego.Controller)

func UnmarshalErr403

func UnmarshalErr403(o *beego.Controller, err error)

Types

type AuthReq

type AuthReq struct {
	UserName string `json:"user_name"`
	Password string `json:"password"`
}

type CfgController

type CfgController struct {
	beego.Controller
}

Operations about Configration

func (*CfgController) CfgOpenStack

func (self *CfgController) CfgOpenStack(body []byte)

func (*CfgController) CfgRegularCheck

func (self *CfgController) CfgRegularCheck(timeInterval string)

func (*CfgController) Post

func (self *CfgController) Post()

@Title configration openstack @Description configration openstack @Success 200 {string} success @Failure 403 invalid request body @Failure 406 config openstack error @router / [post]

type CniMasterPortController

type CniMasterPortController struct {
	beego.Controller
}

Operations about Master

func (*CniMasterPortController) Attach

func (o *CniMasterPortController) Attach()

@Title Attach port to virtual machine for virtualized scene @Description attach port and return it to knitter @Param port_id string models.AttachPortReq true "The port_id attaching to vm" @Success 200 {string} attach success! @Failure 406 create port failed @router /:vm_id/:port_id [post]

func (*CniMasterPortController) Delete

func (o *CniMasterPortController) Delete()

@Title delete @Description detach port from the given VM and delete it @Param port_id path string true "The objectId you want to delete" @Success 200 {string} delete success! @Failure 404 delete failed @router /:port_id [delete]

func (*CniMasterPortController) Detach

func (o *CniMasterPortController) Detach()

@Title delete @Description detach port from the given VM @Param port_id path string true "The port_id you want to detach" @Success 200 {string} detach success! @Failure 406 operation failed @router /:vm_id/:port_id [delete]

func (*CniMasterPortController) Post

func (c *CniMasterPortController) Post()

@Title create port @Description create port and return it to knitter @Param body body models.CreatePortReq true "The master create port" @Success 200 {object} models.CreatePortResp @Failure 403 params is not enough @Failure 406 create port failed @router / [post]

type EncapCreateProviderNetwork

type EncapCreateProviderNetwork struct {
	Network *models.CreateProviderNetwork `json:"provider_network"`
}

type EncapIPGroup

type EncapIPGroup struct {
	IPGrp *IPGroup `json:"ipgroup"`
}

type EncapIPGroupReq

type EncapIPGroupReq struct {
	IPGrp *IPGroupReq `json:"ipgroup"`
}

type EncapIPGroups

type EncapIPGroups struct {
	IPGrps []*IPGroup `json:"ipgroups"`
}

type EncapNetworkExten

type EncapNetworkExten struct {
	Network *iaasaccessor.NetworkExtenAttrs `json:"network_exten"`
}

type EncapPaasNetwork

type EncapPaasNetwork struct {
	Network *Network `json:"network"`
}

type EncapPaasNetworks

type EncapPaasNetworks struct {
	Networks []*Network `json:"networks"`
}

type EncapPaasTenant

type EncapPaasTenant struct {
	Tenant *models.PaasTenant `json:"tenant"`
}

type EncapPaasTenants

type EncapPaasTenants struct {
	Tenants []*models.PaasTenant `json:"tenants"`
}

type ExclusivePaasTenantReq

type ExclusivePaasTenantReq struct {
	Name       string        `json:"name"`
	IaasTenant IaasTenantReq `json:"iaas_tenant"`
}

func (*ExclusivePaasTenantReq) Check

func (self *ExclusivePaasTenantReq) Check() error

func (*ExclusivePaasTenantReq) MakeModelsExclusiveTenant

func (self *ExclusivePaasTenantReq) MakeModelsExclusiveTenant() *models.ExclusiveTenant

type HealthController

type HealthController struct {
	beego.Controller
}

Operations about network

func (*HealthController) Get

func (self *HealthController) Get()

@Title Get @Description get health level @Success 200 {object} models.HealthObj @router / [get]

type IP

type IP struct {
	IPAddr string `json:"ip_addr"`
	Used   bool   `json:"used"`
}

type IPGroup

type IPGroup struct {
	Name  string `json:"name"`
	ID    string `json:"id"`
	IPs   []IP   `json:"ips"`
	NetID string `json:"network_id"`
	Size  int    `json:"size"`
}

type IPGroupController

type IPGroupController struct {
	beego.Controller
}

func (*IPGroupController) Delete

func (self *IPGroupController) Delete()

@Title DeleteIG @Description delete ip group by id @Param id path string true "The ip group id you want to delete" @Success 200 {string} delete success! @Failure 404 ip group not Exist @router /:group [delete]

func (*IPGroupController) Get

func (self *IPGroupController) Get()

@Title GetIG @Description find ip group by id @Param id path string true "the ip group id you want to get" @Success 200 {object} EncapIpGroup @Failure 404 : ip group Not Exist @router /:group [get]

func (*IPGroupController) GetAll

func (self *IPGroupController) GetAll()

@Title GetAllIG @Description get all ip group @Success 200 {object} EncapIpGroups @router / [get]

func (*IPGroupController) Post

func (self *IPGroupController) Post()

@Title create @Description create ip group @Param body body models.IpGroup true "configration for ip group" @Success 200 EncapIpGroup @Failure 404 invalid request body @Failure 500 create ip group error @router / [post]

func (*IPGroupController) Put

func (self *IPGroupController) Put()

@Title PutIG @Description modify ip group by id @Param id path string true "the ip group id you want to modify" @Success 200 {object} EncapIpGroup @Failure 404 : ip group Not Exist @router /:group [put]

type IPGroupReq

type IPGroupReq struct {
	Name      string `json:"name"`
	IPs       string `json:"ips"`
	NetworkID string `json:"network_id"`
	Size      string `json:"size"`
}

type IaasTenantReq

type IaasTenantReq struct {
	Endpoint   string  `json:"endpoint"`
	TenantName string  `json:"tenant_name"`
	Auth       AuthReq `json:"auth"`
}

type IaasTenantRsp

type IaasTenantRsp struct {
	TenantName string `json:"tenant_name"`
	ID         string `json:"id"`
}

type InitCfgController

type InitCfgController struct {
	beego.Controller
}

func (*InitCfgController) Post

func (self *InitCfgController) Post()

@Title configration openstack @Description configration openstack @Success 200 {string} success @Failure 403 invalid request body @Failure 406 config openstack error @router / [post]

type LogController

type LogController struct {
	beego.Controller
}

func (*LogController) Put

func (l *LogController) Put()

@Title modify log level @Description modify log level for klog @Failure 403 params is invalid @router /:log_level [put]

type Network

type Network struct {
	Name            string                   `json:"name"`
	ID              string                   `json:"network_id"`
	GateWay         string                   `json:"gateway"`
	Cidr            string                   `json:"cidr"`
	CreateTime      string                   `json:"create_time"`
	Status          string                   `json:"state"`
	Public          bool                     `json:"public"`
	ExternalNet     bool                     `json:"external"`
	Owner           string                   `json:"owner"`
	Description     string                   `json:"description"`
	SubnetID        string                   `json:"subnet_id"`
	AllocationPools []subnets.AllocationPool `json:"allocation_pools"`
}

type NetworkController

type NetworkController struct {
	beego.Controller
}

Operations about network

func (*NetworkController) CreateNetwork

func (self *NetworkController) CreateNetwork(req *jason.Object) error

func (*NetworkController) CreateProviderNetwork

func (self *NetworkController) CreateProviderNetwork(req *jason.Object) (err error)

func (*NetworkController) Delete

func (self *NetworkController) Delete()

@Title delete @Description delete network by network_id @Param network_id path string true "The network_id you want to delete" @Success 200 {string} delete success! @Failure 404 Network not Exist @router /:network_id [delete]

func (*NetworkController) Get

func (self *NetworkController) Get()

@Title Get @Description find network by network_id @Param network_id path string true "the network_id you want to get" @Success 200 {object} models.EncapNetwork @Failure 404 : Network Not Exist @router /:network_id [get]

func (*NetworkController) GetAll

func (self *NetworkController) GetAll()

@Title GetAll @Description get all network @Success 200 {object} models.EncapNetworks @router / [get]

func (*NetworkController) GetAllNetworks

func (self *NetworkController) GetAllNetworks()

func (*NetworkController) GetAllPublicNetworks

func (self *NetworkController) GetAllPublicNetworks()

func (*NetworkController) GetNetworkExtenInfo

func (self *NetworkController) GetNetworkExtenInfo(id string)

func (*NetworkController) GetNetworkInfo

func (self *NetworkController) GetNetworkInfo(id string)

func (*NetworkController) GetUserAllNetworks

func (self *NetworkController) GetUserAllNetworks(tenantID, networkName string)

func (*NetworkController) Post

func (self *NetworkController) Post()

@Title create @Description create network @Param body body models.EncapNetwork true "configration for network" @Success 200 {string} models.Network.Id @Failure 403 invalid request body @Failure 406 create network error @router / [post]

func (*NetworkController) RegisterNetwork

func (self *NetworkController) RegisterNetwork(extNetwork *jason.Object) error

type NetworkManagerController

type NetworkManagerController struct {
	beego.Controller
}

Operations about network

func (*NetworkManagerController) Get

func (self *NetworkManagerController) Get()

@Title Get @Description get health level @Success 200 {object} models.HealthObj @router / [get]

type PaasNetController

type PaasNetController struct {
	beego.Controller
}

Operations about Master

func (*PaasNetController) Get

func (o *PaasNetController) Get()

@Title get network info by name @Description create port and return it to knitter @Success 200 {object} models.GetVLanInfoResp @Failure 406 process is error @router /:network_name [get]

func (*PaasNetController) Post

func (self *PaasNetController) Post()

@Title get network attrs @Description create port and return it to knitter @Param body body models.Master true "The master get VLan ID" @Success 200 {object} models.GetVLanInfoResp @Failure 403 body is empty @router / [post]

type PaasTenantRsp

type PaasTenantRsp struct {
	Tenant TenantRsp `json:"tenant"`
}

type PaasTenantsRsp

type PaasTenantsRsp struct {
	Tenants []*TenantRsp `json:"tenant"`
}

type PhyPortController

type PhyPortController struct {
	beego.Controller
}

func (*PhyPortController) Delete

func (o *PhyPortController) Delete()

@router /:vm_id/:port_id [delete]

func (*PhyPortController) Post

func (o *PhyPortController) Post()

@router / [post]

type Physnet

type Physnet struct {
	DefaultPhysnet string `json:"default_physnet"`
}

type PhysnetController

type PhysnetController struct {
	beego.Controller
}

Operations about tenant

func (*PhysnetController) Get

func (self *PhysnetController) Get()

@Title get @Description update default physnet @Failure 403 invalid request @Failure 406 get defaultpyhsnet error @router / [get]

func (*PhysnetController) Update

func (self *PhysnetController) Update()

@Title update @Description update default physnet @Success 200 {string} models.Physnet.DefaultPhysnet @Failure 403 invalid request body @Failure 406 update defaultpyhsnet error @router / [post]

type PodController

type PodController struct {
	beego.Controller
}

Operations about Pod

func (*PodController) Get

func (self *PodController) Get()

@Title Get @Description find pod by pod_name @Param pod_name path string true "the pod_name you want to get" @Success 200 {object} models.EncapPod @Failure 404 :pod_name is empty @router /:pod_name [get]

func (*PodController) GetAll

func (self *PodController) GetAll()

@Title GetAll @Description get all pods @Success 200 {object} models.EncapPods @router / [get]

type QuotasRsp

type QuotasRsp struct {
	Network int `json:"network"`
}

type RouterController

type RouterController struct {
	beego.Controller
}

Operations about network

func (*RouterController) Attach

func (self *RouterController) Attach()

@Title attach network @Description attach network to router @Param router_id path string true "the router_id you want to get" @Param body body models.EncapNetwork true "network want to attach" @Success 200 {string} OK @Failure 403 invalid request body @Failure 406 attach router error @router /:router_id/attach [put]

func (*RouterController) Delete

func (self *RouterController) Delete()

@Title delete @Description delete router by router_id @Param router_id path string true "The router_id you want to delete" @Success 200 {string} delete success! @Failure 404 Router not Exist @router /:router_id [delete]

func (*RouterController) Detach

func (self *RouterController) Detach()

@Title detach network @Description detach network to router @Param router_id path string true "the router_id you want to get" @Param body body models.EncapNetwork true "network want to detach" @Success 200 {string} OK @Failure 403 invalid request body @Failure 406 detach router error @router /:router_id/detach [put]

func (*RouterController) Get

func (self *RouterController) Get()

@Title Get @Description find router by router_id @Param router_id path string true "the router_id you want to get" @Success 200 {object} models.EncapRouter @Failure 404 : Router Not Exist @router /:router_id [get]

func (*RouterController) GetAll

func (self *RouterController) GetAll()

@Title GetAll @Description get all routers @Success 200 {object} models.EncapRouters @router / [get]

func (*RouterController) Post

func (self *RouterController) Post()

@Title create @Description create router @Param body body models.EncapRouter true "configration for router" @Success 200 {string} models.Router.Id @Failure 403 invalid request body @Failure 406 create router error @router / [post]

func (*RouterController) Update

func (self *RouterController) Update()

@Title update @Description update router @Param router_id path string true "the router_id you want to update" @Param body body models.EncapRouter true "new configration for router" @Success 200 {string} models.Router.Id @Failure 403 invalid request body @Failure 406 update router error @router /:router_id/ [put]

type SyncController

type SyncController struct {
	beego.Controller
}

Operations about Master

func (*SyncController) Get

func (o *SyncController) Get()

@Title get VLan ID of network for sr_iov in ITRAN2.0 site side @Description create port and return it to knitter @Param body body models.Master true "The master get VLan ID" @Success 200 {object} models.GetVLanInfoResp @Failure 403 body is empty @router /:internal_ip [get]

type TenantController

type TenantController struct {
	beego.Controller
}

Operations about tenant

func (*TenantController) Delete

func (self *TenantController) Delete()

@Title delete @Description delete tenant all networks @Param tenant_uuid path string true "The tenant_uuid you want to delete" @Success 200 {string} delete success! @Failure 404 tenant not Exist @router /:user [delete]

func (*TenantController) Get

func (self *TenantController) Get()

@Title get @Description show tenant @Param tenant_uuid path string true "The tenant_uuid you want to show" @Success 200 {string} get success! @Failure 404 tenant not Exist @router /:user [get]

func (*TenantController) GetAll

func (self *TenantController) GetAll()

@Title get @Description list tenant @Success 200 {string} get success! @Failure 404 tenant not Exist @router / [get]

func (*TenantController) Post

func (self *TenantController) Post()

@Title create @Description create tenant with lan network @Param body body models.EncapNetwork true "The tenant_uuid you want to create" @Success 200 {string} models.Network.Id @Failure 403 invalid request body @Failure 406 create tenant error @router /:user [post]

func (*TenantController) PostExclusive

func (self *TenantController) PostExclusive()

@Title create exclusive tenant @Description create exclusive tenant with lan network @Success 200 {tenant} models.Network.Id @Failure 400 invalid request body @Failure 406 auth error @Failure 500 panic @Failure 409 already exist @router / [post]

func (*TenantController) Update

func (self *TenantController) Update()

@Title update @Description update tenant quota @Success 200 {string} models.Tenant @Failure 406 update quota error @router /:user/quota/ [put]

type TenantRsp

type TenantRsp struct {
	CreatedAt  string        `json:"created_at"`
	ID         string        `json:"id"`
	Name       string        `json:"name"`
	NetNumber  int           `json:"net_number"`
	IaasTenant IaasTenantRsp `json:"iaas_tenant"`
	Quotas     QuotasRsp     `json:"quotas"`
	Status     string        `json:"status"`
}

type VniController

type VniController struct {
	beego.Controller
}

Operations about Master

func (*VniController) Get

func (o *VniController) Get()

@Title get VLan ID of network for sr_iov in ITRAN2.0 site side @Description create port and return it to knitter @Param body body models.Master true "The master get VLan ID" @Success 200 {object} models.GetVLanInfoResp @Failure 403 body is empty @router /:network_id [get]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL