sdnclient

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateNetwork(networkType l2smv1.NetworkType, config interface{}) error
	DeleteNetwork(networkType l2smv1.NetworkType, networkID string) error
	CheckNetworkExists(networkType l2smv1.NetworkType, networkID string) (bool, error)
	AttachPodToNetwork(networkType l2smv1.NetworkType, config interface{}) error
}

NetworkStrategy defines the interface for network strategies

func NewClient

func NewClient(clientType ClientType, config ClientConfig) (Client, error)

type ClientConfig

type ClientConfig struct {
	BaseURL  string
	Username string
	Password string
}

type ClientType

type ClientType string
const (
	InternalType ClientType = "internal"
	ExternalType ClientType = "external"
)

type ExternalClient

type ExternalClient struct {
	Session *SessionClient
}

ExternalClient is part of the Client interface, and implements the SessionClient, which is a wrapper of the http function this type of client is for the specific idco onos app, which manages inter cluster networks.

func (*ExternalClient) AttachPodToNetwork

func (c *ExternalClient) AttachPodToNetwork(networkType l2smv1.NetworkType, config interface{}) error

AttachPodToNetwork attaches a pod to a network, using the configuration file

func (*ExternalClient) CheckNetworkExists

func (c *ExternalClient) CheckNetworkExists(networkType l2smv1.NetworkType, networkID string) (bool, error)

CheckNetworkExists checks if the specified network exists in the SDN controller

func (*ExternalClient) CreateNetwork

func (c *ExternalClient) CreateNetwork(networkType l2smv1.NetworkType, config interface{}) error

CreateNetwork creates a new network in the SDN controller

func (*ExternalClient) DeleteNetwork

func (c *ExternalClient) DeleteNetwork(networkType l2smv1.NetworkType, networkID string) error

DeleteNetwork deletes an existing network from the SDN controller

type InternalClient

type InternalClient struct {
	Session *SessionClient
}

InternalClient is part of the Client interface, and implements the SessionClient, which is a wrapper of the http function. this type of client is for the specific l2sm-controller onos app, which manages intra cluster networks.

func (*InternalClient) AttachPodToNetwork

func (c *InternalClient) AttachPodToNetwork(networkType l2smv1.NetworkType, config interface{}) error

AttachPodToNetwork checks if the specified network exists in the SDN controller

func (*InternalClient) CheckNetworkExists

func (c *InternalClient) CheckNetworkExists(networkType l2smv1.NetworkType, networkID string) (bool, error)

CheckNetworkExists checks if the specified network exists in the SDN controller

func (*InternalClient) CreateNetwork

func (c *InternalClient) CreateNetwork(networkType l2smv1.NetworkType, config interface{}) error

CreateNetwork creates a new network in the SDN controller

func (*InternalClient) DeleteNetwork

func (c *InternalClient) DeleteNetwork(networkType l2smv1.NetworkType, networkID string) error

DeleteNetwork deletes an existing network from the SDN controller

func (*InternalClient) DetachPodFromNetwork

func (c *InternalClient) DetachPodFromNetwork(networkType l2smv1.NetworkType, portID string) error

DetachPodFromNetwork detaches the pod from the network, so it can be used in the future TODO: Implement in onos

type SessionClient

type SessionClient struct {
	BaseURL   string
	AuthToken string
	// contains filtered or unexported fields
}

SessionClient wraps around http.Client and automatically adds authorization headers.

func NewSessionClient

func NewSessionClient(baseURL, username, password string) *SessionClient

NewSessionClient creates a new SessionClient with basic auth credentials.

func (*SessionClient) Delete

func (c *SessionClient) Delete(url string) (*http.Response, error)

Delete wraps the DELETE method with authorization.

func (*SessionClient) Do

func (c *SessionClient) Do(req *http.Request) (*http.Response, error)

Do sends an HTTP request and returns an HTTP response, similar to http.Client's Do.

func (*SessionClient) Get

func (c *SessionClient) Get(url string) (*http.Response, error)

Get wraps the GET method with authorization.

func (*SessionClient) Post

func (c *SessionClient) Post(url string, body []byte) (*http.Response, error)

Post wraps the POST method with authorization.

type VnetPayload

type VnetPayload struct {
	NetworkId string `json:"networkId"`
}

type VnetPortPayload

type VnetPortPayload struct {
	NetworkId string   `json:"networkId"`
	Port      []string `json:"networkEndpoints,omitempty"`
}

Jump to

Keyboard shortcuts

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