Skip to content

Commit cc1c1f7

Browse files
committed
Sanity cases
minor fix minor fix minor fix minor fix minor fix minor fix minor fix final push minor fixes final push minor fix minor fix changin test time out Changing ubuntu specific commands in tests minor fix fixing test case gofmt minor fix reducing num containers retry minor fix minor fix adapting to vagrant ssh changes retry retry retry retry final push
1 parent ea15b43 commit cc1c1f7

File tree

15 files changed

+1216
-46
lines changed

15 files changed

+1216
-46
lines changed

Godeps/_workspace/src/github.com/contiv/vagrantssh/vagrant.go

+8-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,14 @@ unit-test: stop clean build
9494
centos-tests:
9595
CONTIV_NODE_OS=centos make clean build unit-test system-test stop
9696

97-
system-test: start
98-
godep go test -v -timeout 120m ./systemtests -check.v
97+
system-test:start
98+
godep go test -v -timeout 240m ./systemtests -check.v
99+
100+
l3-test:
101+
CONTIV_L3=2 CONTIV_NODES=3 vagrant destroy -f
102+
CONTIV_L3=2 CONTIV_NODES=3 vagrant up
103+
CONTIV_L3=2 CONTIV_NODES=3 godep go test -v -timeout 240m ./systemtests -check.v
104+
CONTIV_L3=2 CONTIV_NODES=3 vagrant destroy -f
99105

100106
host-build:
101107
@echo "dev: making binaries..."

Vagrantfile

100644100755
+67-6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ echo 'export GOSRC=$GOPATH/src' >> /etc/profile.d/envvar.sh
2424
echo 'export PATH=$PATH:/usr/local/go/bin:$GOBIN' >> /etc/profile.d/envvar.sh
2525
echo "export http_proxy='$4'" >> /etc/profile.d/envvar.sh
2626
echo "export https_proxy='$5'" >> /etc/profile.d/envvar.sh
27-
echo "export no_proxy=192.168.2.10,192.168.2.11,127.0.0.1,localhost,netmaster" >> /etc/profile.d/envvar.sh
28-
echo "export CLUSTER_NODE_IPS=192.168.2.10,192.168.2.11" >> /etc/profile.d/envvar.sh
27+
echo "export no_proxy=192.168.2.10,192.168.2.11,127.0.0.1,localhost,netmaster,192.168.2.12" >> /etc/profile.d/envvar.sh
28+
echo "export CLUSTER_NODE_IPS=192.168.2.10,192.168.2.11,192.168.2.12" >> /etc/profile.d/envvar.sh
2929
echo "export USE_RELEASE=$6" >> /etc/profile.d/envvar.sh
3030
3131
@@ -43,7 +43,7 @@ systemctl enable docker-tcp.socket
4343
4444
mkdir /etc/systemd/system/docker.service.d
4545
echo "[Service]" | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf
46-
echo "Environment=\\\"no_proxy=192.168.2.10,192.168.2.11,127.0.0.1,localhost,netmaster\\\" \\\"http_proxy=$http_proxy\\\" \\\"https_proxy=$https_proxy\\\"" | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf
46+
echo "Environment=\\\"no_proxy=192.168.2.10,192.168.2.11,192.168.2.12,127.0.0.1,localhost,netmaster\\\" \\\"http_proxy=$http_proxy\\\" \\\"https_proxy=$https_proxy\\\"" | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf
4747
sudo systemctl daemon-reload
4848
sudo systemctl stop docker
4949
systemctl start docker-tcp.socket
@@ -69,14 +69,20 @@ rm /etc/docker/key.json
6969
docker load --input #{gopath_folder}/src/github.com/contiv/netplugin/scripts/dnscontainer.tar
7070
SCRIPT
7171

72+
provision_bird = <<SCRIPT
73+
## setup the environment file. Export the env-vars passed as args to 'vagrant up'
74+
echo Args passed: [[ $@ ]]
75+
echo "export http_proxy='$1'" >> /etc/profile.d/envvar.sh
76+
echo "export https_proxy='$2'" >> /etc/profile.d/envvar.sh
77+
source /etc/profile.d/envvar.sh
78+
SCRIPT
79+
7280
VAGRANTFILE_API_VERSION = "2"
7381
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7482
if ENV['CONTIV_NODE_OS'] && ENV['CONTIV_NODE_OS'] == "centos" then
7583
config.vm.box = "contiv/centos71-netplugin"
76-
config.vm.box_version = "0.3.1"
7784
else
7885
config.vm.box = "contiv/ubuntu1504-netplugin"
79-
config.vm.box_version = "0.3.1"
8086
end
8187
num_nodes = 2
8288
if ENV['CONTIV_NODES'] && ENV['CONTIV_NODES'] != "" then
@@ -86,6 +92,44 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8692
node_ips = num_nodes.times.collect { |n| base_ip + "#{n+10}" }
8793
node_names = num_nodes.times.collect { |n| "netplugin-node#{n+1}" }
8894
node_peers = []
95+
if ENV['CONTIV_L3'] then
96+
config.vm.define "quagga1" do |quagga1|
97+
98+
quagga1.vm.box = "contiv/quagga1"
99+
quagga1.vm.host_name = "quagga1"
100+
quagga1.vm.network :private_network, ip: "192.168.1.50", virtualbox__intnet: "true", auto_config: false
101+
quagga1.vm.network "private_network",
102+
ip: "80.1.1.200",
103+
virtualbox__intnet: "contiv_orange"
104+
quagga1.vm.network "private_network",
105+
ip: "70.1.1.2",
106+
virtualbox__intnet: "contiv_blue"
107+
quagga1.vm.provision "shell" do |s|
108+
s.inline = provision_bird
109+
s.args = [ENV["http_proxy"] || "", ENV["https_proxy"] || ""]
110+
end
111+
end
112+
config.vm.define "quagga2" do |quagga2|
113+
114+
quagga2.vm.box = "contiv/quagga2"
115+
quagga2.vm.host_name = "quagga2"
116+
quagga2.vm.network :private_network, ip: "192.168.1.50", virtualbox__intnet: "true", auto_config: false
117+
quagga2.vm.network "private_network",
118+
ip: "70.1.1.1",
119+
virtualbox__intnet: "contiv_blue"
120+
quagga2.vm.network "private_network",
121+
ip: "60.1.1.200",
122+
virtualbox__intnet: "contiv_green"
123+
quagga2.vm.network "private_network",
124+
ip: "50.1.1.200",
125+
virtualbox__intnet: "contiv_yellow"
126+
127+
quagga2.vm.provision "shell" do |s|
128+
s.inline = provision_bird
129+
s.args = [ENV["http_proxy"] || "", ENV["https_proxy"] || ""]
130+
end
131+
end
132+
end
89133

90134
num_nodes.times do |n|
91135
node_name = node_names[n]
@@ -103,12 +147,29 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
103147
swarm_flag = "slave"
104148
end
105149
end
150+
net_num = (n+1)%3
151+
if net_num == 0 then
152+
network_name = "contiv_orange"
153+
else
154+
if net_num == 1 then
155+
network_name = "contiv_yellow"
156+
else
157+
network_name = "contiv_green"
158+
end
159+
end
106160
config.vm.define node_name do |node|
161+
node.vm.box_version = "0.3.1"
162+
107163
# node.vm.hostname = node_name
108164
# create an interface for etcd cluster
109165
node.vm.network :private_network, ip: node_addr, virtualbox__intnet: "true", auto_config: false
110166
# create an interface for bridged network
111-
node.vm.network :private_network, ip: "0.0.0.0", virtualbox__intnet: "true", auto_config: false
167+
if ENV['CONTIV_L3'] then
168+
# create an interface for bridged network
169+
node.vm.network :private_network, ip: "0.0.0.0", virtualbox__intnet: network_name, auto_config: false
170+
else
171+
node.vm.network :private_network, ip: "0.0.0.0", virtualbox__intnet: "true", auto_config: false
172+
end
112173
node.vm.provider "virtualbox" do |v|
113174
# make all nics 'virtio' to take benefit of builtin vlan tag
114175
# support, which otherwise needs to be enabled in Intel drivers,

netmaster/objApi/apiController.go

+28
Original file line numberDiff line numberDiff line change
@@ -1054,5 +1054,33 @@ func (ac *APIController) BgpDelete(bgpCfg *contivModel.Bgp) error {
10541054

10551055
//BgpUpdate updates bgp config
10561056
func (ac *APIController) BgpUpdate(oldbgpCfg *contivModel.Bgp, NewbgpCfg *contivModel.Bgp) error {
1057+
log.Infof("Received BgpUpdate: %+v", NewbgpCfg)
1058+
1059+
if NewbgpCfg.Hostname == "" {
1060+
return core.Errorf("Invalid host name")
1061+
}
1062+
1063+
// Get the state driver
1064+
stateDriver, err := utils.GetStateDriver()
1065+
if err != nil {
1066+
return err
1067+
}
1068+
1069+
// Build bgp config
1070+
bgpIntentCfg := intent.ConfigBgp{
1071+
Hostname: NewbgpCfg.Hostname,
1072+
RouterIP: NewbgpCfg.Routerip,
1073+
As: NewbgpCfg.As,
1074+
NeighborAs: NewbgpCfg.NeighborAs,
1075+
Neighbor: NewbgpCfg.Neighbor,
1076+
}
1077+
1078+
// Add the Bgp neighbor
1079+
err = master.AddBgp(stateDriver, &bgpIntentCfg)
1080+
if err != nil {
1081+
log.Errorf("Error creating Bgp neighbor {%+v}. Err: %v", NewbgpCfg.Neighbor, err)
1082+
return err
1083+
}
1084+
10571085
return nil
10581086
}

netplugin/netd.go

+7
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,15 @@ func processStateEvent(netPlugin *plugin.NetPlugin, opts cliOpts, rsps chan core
178178
isDelete = true
179179
eventStr = "delete"
180180
} else if rsp.Prev != nil {
181+
log.Infof("Received a modify event, ignoring it")
182+
if bgpCfg, ok := currentState.(*mastercfg.CfgBgpState); ok {
183+
log.Infof("Received %q for Bgp: %q", eventStr, bgpCfg.Hostname)
184+
processBgpEvent(netPlugin, opts, bgpCfg.Hostname, isDelete)
185+
continue
186+
}
181187
log.Infof("Received a modify event, ignoring it")
182188
continue
189+
183190
}
184191
if nwCfg, ok := currentState.(*mastercfg.CfgNetworkState); ok {
185192
log.Infof("Received %q for network: %q", eventStr, nwCfg.ID)

scripts/gobgp

13.2 MB
Binary file not shown.

systemtests/aci_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import (
66
)
77

88
func (s *systemtestSuite) TestACIMode(c *C) {
9+
if s.fwdMode == "routing" {
10+
return
11+
}
912
c.Assert(s.cli.GlobalPost(&client.Global{
1013
Name: "global",
1114
NetworkInfraType: "aci",

systemtests/basic_test.go

100644100755
+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ func (s *systemtestSuite) TestBasicStartRemoveContainerVLAN(c *C) {
2323
}
2424

2525
func (s *systemtestSuite) testBasicStartRemoveContainer(c *C, encap string) {
26+
27+
if s.fwdMode == "routing" && encap == "vlan" {
28+
c.Skip("Skipping test")
29+
}
2630
c.Assert(s.cli.NetworkPost(&client.Network{
2731
PktTag: 1001,
2832
NetworkName: "private",
@@ -51,6 +55,9 @@ func (s *systemtestSuite) TestBasicStartStopContainerVLAN(c *C) {
5155
}
5256

5357
func (s *systemtestSuite) testBasicStartStopContainer(c *C, encap string) {
58+
if s.fwdMode == "routing" && encap == "vlan" {
59+
c.Skip("Skipping test")
60+
}
5461
c.Assert(s.cli.NetworkPost(&client.Network{
5562
PktTag: 1001,
5663
NetworkName: "private",

0 commit comments

Comments
 (0)