utils

package
v0.0.0-...-f149185 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

*

  • File : ovs.go
  • Author : Iman Tabrizian <iman.tabrizian@gmail.com>
  • Date : 04.04.2019
  • Last Modified Date: 15.04.2019
  • Last Modified By : Iman Tabrizian <iman.tabrizian@gmail.com>

*

  • File : ryu.go
  • Author : Iman Tabrizian <iman.tabrizian@gmail.com>
  • Date : 14.04.2019
  • Last Modified Date: 22.05.2019
  • Last Modified By : Iman Tabrizian <iman.tabrizian@gmail.com>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthRequest

func AuthRequest(verb string, url string, body string, authToken string) []byte

func InstallOVS

func InstallOVS(vm models.VM)

func PublicKeyFile

func PublicKeyFile(file string) ssh.AuthMethod

func RunCommand

func RunCommand(vm models.VM, cmd string) ([]byte, []byte)

func RunCommandFromOverlay

func RunCommandFromOverlay(vm models.VM, cmd string, overlayIP string) ([]byte, []byte)

func RunCommandOverSSH

func RunCommandOverSSH(ip string, cmd string) ([]byte, []byte)

func SetController

func SetController(vm models.VM, ctrlEndpoint string)

func SetOverlayInterface

func SetOverlayInterface(vm models.VM, hostOverlayIP string)

Types

type ConsulClient

type ConsulClient struct {
	URL string
}

func NewConsulClient

func NewConsulClient(url string) (*ConsulClient, error)

func (*ConsulClient) DeleteService

func (consulClient *ConsulClient) DeleteService(service *Service) ([]byte, error)

func (*ConsulClient) RegisterService

func (consulClient *ConsulClient) RegisterService(service *Service) ([]byte, error)

type Match

type Match struct {
	DLSrc   string `json:"dl_src,omitempty"`
	DLDst   string `json:"dl_dst,omitempty"`
	InPort  int    `json:"in_port,omitempty"`
	DLType  int    `json:"dl_type,omitempty"`
	NWSrc   string `json:"nw_src,omitempty"`
	NWDst   string `json:"nw_dst,omitempty"`
	NWProto int    `json:"nw_proto,omitempty"`
	TPDst   int    `json:"tp_dst,omitempty"`
}

type OpenStackClient

type OpenStackClient struct {
	AuthToken  string
	Auth       models.AuthConfiguration
	NovaURL    string
	NetworkURL string
}

func NewOpenStackClient

func NewOpenStackClient(auth models.AuthConfiguration) (*OpenStackClient, error)

func (*OpenStackClient) CreateServer

func (osClient *OpenStackClient) CreateServer(name string, vmConfiguration models.VMConfiguration) *models.VM

func (*OpenStackClient) GetAuthToken

func (osClient *OpenStackClient) GetAuthToken() string

func (*OpenStackClient) GetFlavorID

func (osClient *OpenStackClient) GetFlavorID(flavor string) string

func (*OpenStackClient) GetImageID

func (osClient *OpenStackClient) GetImageID(image string) string

func (*OpenStackClient) GetNetworkID

func (osClient *OpenStackClient) GetNetworkID(network string) string

func (*OpenStackClient) GetNovaURL

func (osClient *OpenStackClient) GetNovaURL() string

func (*OpenStackClient) GetSecgroupID

func (osClient *OpenStackClient) GetSecgroupID(secgroup string) string

type PortAction

type PortAction struct {
	Port int    `json:"port"`
	Type string `json:"type"`
}

type Rule

type Rule struct {
	Matching Match        `json:"match"`
	Action   []PortAction `json:"actions"`
	Dpid     int          `json:"dpid"`
	Priority int          `json:"priority,omitempty"`
}

type RyuClient

type RyuClient struct {
	URL string
}

func NewRyuClient

func NewRyuClient(URL string) (*RyuClient, error)

func (*RyuClient) DeleteAll

func (ryuClient *RyuClient) DeleteAll() error

func (*RyuClient) DeleteFlow

func (ryuClient *RyuClient) DeleteFlow(rule Rule) ([]byte, error)

func (*RyuClient) FindShortestPath

func (ryuClient *RyuClient) FindShortestPath(src string, dst string) []string

func (*RyuClient) GetSwitches

func (ryuClient *RyuClient) GetSwitches() ([]RyuSwitch, error)

Returns the list of all of the switches

func (*RyuClient) InstallFlow

func (ryuClient *RyuClient) InstallFlow(rule Rule) ([]byte, error)

type RyuPort

type RyuPort struct {
	HWAddr string `json:"hw_addr"`
	Name   string `json:"name"`
	PortNo string `json:"port_no"`
	DPid   string `json:"dpid"`
}

type RyuSwitch

type RyuSwitch struct {
	Ports []RyuPort
	Dpid  string
}

type Service

type Service struct {
	Address string   `json:"Address"`
	Name    string   `json:"Name"`
	Port    int      `json:"Port"`
	Tags    []string `json:"Tags"`
}

Jump to

Keyboard shortcuts

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