manager

package
Version: 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: 20 Imported by: 10

Documentation

Index

Constants

View Source
const MaxRetryTimesForHTTPReq int = 6

Variables

View Source
var Delete = func(url string) (resp *http.Response, err error) {
	client := &http.Client{Timeout: constvalue.HTTPDefaultTimeoutInSec * time.Second}
	req, errreq := http.NewRequest("DELETE", url, nil)
	if errreq != nil {
		klog.Errorf("##Delete2Master http.NewRequest(DELETE,url,nil) error! -%v", errreq)
		return nil, errreq
	}

	resp, errresp := client.Do(req)
	if errresp != nil {
		klog.Errorf("##Delete2Master http.DefaultClient.Do(req) error! -%v", errresp)
		return nil, errresp
	}
	klog.Infof("##temp##:HttpDelete success! errreq and errresp should nil")
	return resp, nil
}
View Source
var DeleteNeutronPort = func(m *ManagerClient, portID string, tenantID string) error {
	return m.DeleteNeutronPort(portID, tenantID)
}
View Source
var HTTPClose = func(resp *http.Response) error {
	return resp.Body.Close()
}
View Source
var HTTPDelete = func(url string) (*http.Response, error) {
	var resp *http.Response
	var err error
	for i := 1; i < MaxRetryTimesForHTTPReq; i++ {
		resp, err = Delete(url)
		if err == nil {
			return resp, nil
		}
		time.Sleep(time.Second * time.Duration(i))
	}
	return resp, err
}
View Source
var HTTPGet = func(url string) (*http.Response, error) {
	var resp *http.Response
	var err error
	for i := 1; i < MaxRetryTimesForHTTPReq; i++ {
		resp, err = get(url)
		if err == nil {
			return resp, nil
		}
		time.Sleep(time.Second * time.Duration(i))
	}
	return resp, err
}
View Source
var HTTPPost = func(url string, bodyType string, body io.Reader) (*http.Response, error) {
	var resp *http.Response
	var err error
	for i := 1; i < MaxRetryTimesForHTTPReq; i++ {
		resp, err = post(url, bodyType, body)
		if err == nil {
			return resp, nil
		}
		time.Sleep(time.Second * time.Duration(i))
	}
	return resp, err
}
View Source
var HTTPReadAll = func(resp *http.Response) ([]byte, error) {
	return ioutil.ReadAll(resp.Body)
}

Functions

func MakeIPNetByCidr

func MakeIPNetByCidr(cidr string) *net.IPNet

func MakeURLReqIDSuffix

func MakeURLReqIDSuffix(reqID string) string

func NewGUID

func NewGUID(podID string) string

Types

type CreatePortReq

type CreatePortReq struct {
	agtmgr.AgtPortReq
}

type DcVnisEncap

type DcVnisEncap struct {
	Vnis []string `json:"vnis"`
}

type IP

type IP struct {
	SubnetID string `mapstructure:"subnet_id" json:"subnet_id"`
	Address  string `mapstructure:"ip_address" json:"ip_address,omitempty"`
}

type Interface

type Interface struct {
	NetworkID string `json:"networkid"`
	SubnetID  string `json:"subnetid"`
	PortID    string `json:"portid"`
	Name      string `json:"name"`
	IP        string `json:"ip"`
	Mac       string `json:"mac"`
	TenantID  string `json:"tenantid"`
	Ownertype string `json:"ownertype"`
	Ownerid   string `json:"ownerid"`
	Porttype  string `json:"porttype"`
	Businfo   string `json:"businfo"`
	NetPlane  string `json:"netplane"`
}

paasnw etcd store port structure

type ManagerClient

type ManagerClient struct {
	// Header *http.Header
	URLKnitterManager string
	VMID              string
}

func (*ManagerClient) CheckKnitterManager

func (m *ManagerClient) CheckKnitterManager() error

func (*ManagerClient) CreateNeutronBulkPorts

func (m *ManagerClient) CreateNeutronBulkPorts(reqID string, req agtmgr.AgtBulkPortsReq, tenantID string) (b []byte, e error)

func (*ManagerClient) CreateNeutronPort

func (m *ManagerClient) CreateNeutronPort(reqID string, req CreatePortReq, tenantID string) (b []byte, e error)

func (*ManagerClient) Delete

func (m *ManagerClient) Delete(deleteURL string) (b []byte, statusCode int, e error)

func (*ManagerClient) DeleteNeutronPort

func (m *ManagerClient) DeleteNeutronPort(portID string, tenantID string) (e error)

func (*ManagerClient) Get

func (m *ManagerClient) Get(postURL string) (int, []byte, error)

func (*ManagerClient) GetAttachURL

func (self *ManagerClient) GetAttachURL(tenantID, portID string) string

func (*ManagerClient) GetCreatePortURL

func (self *ManagerClient) GetCreatePortURL(tenantID string) string

func (*ManagerClient) GetDcVnis

func (self *ManagerClient) GetDcVnis(tenantID, dcID string) ([]string, error)

func (*ManagerClient) GetDcVnisURL

func (self *ManagerClient) GetDcVnisURL(tenantID, dcID string) string

func (*ManagerClient) GetDeletePortURL

func (self *ManagerClient) GetDeletePortURL(tenantID, portID string) string

func (*ManagerClient) GetDetachURL

func (self *ManagerClient) GetDetachURL(tenantID, portID string) string

func (*ManagerClient) GetHealthURL

func (self *ManagerClient) GetHealthURL() string

func (*ManagerClient) GetManagerURLFromK8SConf

func (m *ManagerClient) GetManagerURLFromK8SConf(serverconf []byte) (string, error)

func (*ManagerClient) GetNetInfoByNetName

func (m *ManagerClient) GetNetInfoByNetName(netName, tenantID string) (*mgragt.PaasNetwork, error)

func (*ManagerClient) GetNetworkURL

func (self *ManagerClient) GetNetworkURL(tenantID, netName string) string

func (*ManagerClient) GetNetworksURL

func (self *ManagerClient) GetNetworksURL(tenantID string) string

func (*ManagerClient) GetReportPodURL

func (self *ManagerClient) GetReportPodURL(tenantID string, podName string) string

func (*ManagerClient) GetSegmentIDURLByID

func (self *ManagerClient) GetSegmentIDURLByID(tenantID, networkID string) string

func (*ManagerClient) GetSegmentIDURLByName

func (self *ManagerClient) GetSegmentIDURLByName(tenantID, networkName string) string

func (*ManagerClient) GetSyncInGenModURL

func (self *ManagerClient) GetSyncInGenModURL(tenantID string) string

func (*ManagerClient) GetTenantURL

func (self *ManagerClient) GetTenantURL(tenantID string) string

func (*ManagerClient) GetVMIDFromServerConf

func (m *ManagerClient) GetVMIDFromServerConf(ServerInfo []byte) (string, error)

func (*ManagerClient) GetVnicInterfaceCreateURL

func (self *ManagerClient) GetVnicInterfaceCreateURL(tenantID string) string

func (*ManagerClient) GetVnicInterfaceDeleteURL

func (self *ManagerClient) GetVnicInterfaceDeleteURL(tenantID, vmID, portID string) string

func (*ManagerClient) Init

func (m *ManagerClient) Init(serverconf []byte) error

func (*ManagerClient) InitClient

func (m *ManagerClient) InitClient(cfg *jason.Object) error

func (*ManagerClient) Post

func (m *ManagerClient) Post(postURL string, postDict map[string]string) (int, []byte, error)

func (*ManagerClient) PostBytes

func (m *ManagerClient) PostBytes(postURL string, postData []byte) (int, []byte, error)

type PaaSNwGUID

type PaaSNwGUID string

type Port

type Port struct {
	ID               string `mapstructure:"id" json:"id"`
	NetworkID        string `mapstructure:"network_id" json:"network_id"`
	NetworkName      string `mapstructure:"network_name" json:"network_name"`
	Name             string `mapstructure:"name" json:"name"`
	MACAddress       string `mapstructure:"mac_address" json:"mac_address"`
	FixedIPs         []IP   `mapstructure:"fixed_ips" json:"fixed_ips"`
	TenantID         string `mapstructure:"tenant_id" json:"tenant_id"`
	CIDR             string `mapstructure:"cidr" json:"cidr"`
	GatewayIP        string `mapstructure:"gateway_ip" json:"gateway_ip"`
	MTU              string `mapstructure:"mtu" json:"mtu"`
	NetworkType      string `json:"neutron_network_type"`
	IsDefaultGateway bool   `json:"is_default_gateway"`
	OrgDriver        string `json:"org_driver"`
}

func (*Port) Extract

func (p *Port) Extract(portbyte []byte, netplane, tenantID string) (e error)

func (*Port) GetGatewayIP

func (self *Port) GetGatewayIP() net.IP

func (*Port) GetIPNet

func (self *Port) GetIPNet() *net.IPNet

func (*Port) MakeAddr

func (self *Port) MakeAddr() netlink.Addr

func (*Port) MakeIPNet

func (self *Port) MakeIPNet() *net.IPNet

func (*Port) MakeIPNetByCidr

func (self *Port) MakeIPNetByCidr() *net.IPNet

type VLanInfo

type VLanInfo struct {
	NetworkType     string `json:"network_type"`
	VlanID          string `json:"network_id"`
	PhysicalNetwork string `json:"physical_network"`
}

Source Files

Jump to

Keyboard shortcuts

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