renderer

package
v2.1.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockRenderer

type MockRenderer struct {
	Log logging.Logger
	// contains filtered or unexported fields
}

MockRenderer is a mock implementation of the PolicyRenderer that allows to simulate a traffic and test what the outcome would be with the rendered configuration.

func NewMockRenderer

func NewMockRenderer(name string, log logging.Logger) *MockRenderer

NewMockRenderer is a constructor for MockRenderer.

func (*MockRenderer) GetPodIP

func (mr *MockRenderer) GetPodIP(pod podmodel.ID) (ip string, masklen int)

GetPodIP returns the pod IP + masklen as provided by the configurator.

func (*MockRenderer) NewTxn

func (mr *MockRenderer) NewTxn(resync bool) renderer.Txn

NewTxn creates a new mock transaction.

func (*MockRenderer) TestTraffic

func (mr *MockRenderer) TestTraffic(pod podmodel.ID, direction TrafficDirection, srcIP *net.IP,
	destIP *net.IP, protocol renderer.ProtocolType, srcPort uint16, destPort uint16) TrafficAction

TestTraffic allows to simulate a traffic and test what the outcome would be with the rendered configuration. The direction is from the vswitch point of view!

type MockRendererTxn

type MockRendererTxn struct {
	Log logging.Logger
	// contains filtered or unexported fields
}

MockRendererTxn is a mock implementation for the renderer's transaction.

func (*MockRendererTxn) Commit

func (mrt *MockRendererTxn) Commit() error

Commit runs mock rendering. The configuration is just stored in-memory.

func (*MockRendererTxn) Render

func (mrt *MockRendererTxn) Render(pod podmodel.ID, podIP *net.IPNet, ingress []*renderer.ContivRule, egress []*renderer.ContivRule, removed bool) renderer.Txn

Render just stores config to be rendered.

type PodConfig

type PodConfig struct {
	// contains filtered or unexported fields
}

PodConfig stores configuration for a single pod.

type TrafficAction

type TrafficAction int

TrafficAction is one of DENIED, ALLOWED, UNMATCHED, INVALID.

const (
	// DeniedTraffic is returned by the mock renderer when the traffic is blocked.
	DeniedTraffic TrafficAction = iota

	// AllowedTraffic is returned by the mock renderer when the traffic is not blocked.
	AllowedTraffic

	// UnmatchedTraffic is returned by the mock renderer when the traffic is not
	// matched by any rule.
	UnmatchedTraffic
)

type TrafficDirection

type TrafficDirection int

TrafficDirection is one of: INGRESS, EGRESS.

const (
	// IngressTraffic is the traffic direction from a pod to the vswitch.
	IngressTraffic TrafficDirection = iota

	// EgressTraffic is the traffic direction from the vswitch to a pod.
	EgressTraffic
)

Jump to

Keyboard shortcuts

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