testutils

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	DatastoreEtcdV2 = 1 << iota
	DatastoreK8s
)

Variables

View Source
var EgressRule1 = api.Rule{
	Action:    "pass",
	IPVersion: &ipv4,
	Protocol:  &numProtocol1,
	ICMP:      &icmp1,
	Source: api.EntityRule{
		Tag:      "tag3",
		Net:      &cidr2,
		Selector: "all()",
	},
}
View Source
var EgressRule2 = api.Rule{
	Action:    "allow",
	IPVersion: &ipv6,
	Protocol:  &strProtocol2,
	ICMP:      &icmp1,
	Source: api.EntityRule{
		Tag:      "tag4",
		Net:      &cidrv62,
		Selector: "label2 == '1234'",
	},
}
View Source
var InRule1 = api.Rule{
	Action:    "allow",
	IPVersion: &ipv4,
	Protocol:  &strProtocol1,
	ICMP:      &icmp1,
	Source: api.EntityRule{
		Tag:      "tag1",
		Net:      &cidr1,
		Selector: "label1 == 'value1'",
	},
}
View Source
var InRule2 = api.Rule{
	Action:    "deny",
	IPVersion: &ipv6,
	Protocol:  &numProtocol1,
	ICMP:      &icmp1,
	Source: api.EntityRule{
		Tag:      "tag2",
		Net:      &cidrv61,
		Selector: "has(label2)",
	},
}

Functions

func CleanEtcd

func CleanEtcd()

CleanEtcd is a utility function to wipe clean "/calico" recursively from etcd.

func CleanIPPools added in v1.1.1

func CleanIPPools(c *client.Client)

CleanIPPools removes all IP pool configuration from the datastore.

func CreateNewIPPool

func CreateNewIPPool(c client.Client, poolSubnet string, ipip, natOut, ipam bool)

CreateNewIPPool takes a client.Client with a poolSubnet CIDR (in "192.168.1.0/24" format) with ipip, natOut, and ipam bools for the pool to be setup and creates a new pool.

func CreateRule

func CreateRule(ipv, icmpType, icmpCode int, proto, cidrStr, tag, selector, inAction, eAction string) (api.Rule, api.Rule)

CreateRule takes all fields necessary to create a api.Rule object and returns ingress and egress api.Rules.

func DumpEtcd

func DumpEtcd()

DumpEtcd prints out a recursive dump of the contents of etcd.

func E2eDatastoreDescribe added in v1.1.1

func E2eDatastoreDescribe(description string, datastores int, body func(config api.CalicoAPIConfig)) bool

E2eDatastoreDescribe is a replacement for ginkgo.Describe which invokes Describe multiple times for one or more different datastore drivers - passing in the Calico API configuration as a parameter to the test function. This allows easy construction of end-to-end tests covering multiple different datastore drivers.

The *datastores* parameter is a bit-wise OR of the required datastore drivers that will be tested.

func HookLogrusForGinkgo

func HookLogrusForGinkgo()

func MustParseCIDR

func MustParseCIDR(c string) net.IPNet

MustParseCIDR parses the string into a net.IPNet. The IP address in the IPNet is not masked.

func MustParseIP

func MustParseIP(i string) net.IP

func MustParseNetwork added in v1.1.0

func MustParseNetwork(c string) net.IPNet

MustParseNetwork parses the string into a net.IPNet. The IP address in the IPNet is masked.

func NewClient

func NewClient(cf string) (*client.Client, error)

NewClient is a util function to create a new default client. When passed empty string, it loads the default config instead from a config file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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