github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/provider/maas/bridgescript_test.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package maas 5 6 import ( 7 "fmt" 8 "io/ioutil" 9 "os" 10 "path/filepath" 11 "runtime" 12 "strings" 13 14 jc "github.com/juju/testing/checkers" 15 "github.com/juju/utils/exec" 16 gc "gopkg.in/check.v1" 17 18 coretesting "github.com/juju/juju/testing" 19 ) 20 21 type bridgeConfigSuite struct { 22 coretesting.BaseSuite 23 24 testConfig string 25 testConfigPath string 26 testPythonScript string 27 pythonVersions []string 28 } 29 30 var _ = gc.Suite(&bridgeConfigSuite{}) 31 32 func (s *bridgeConfigSuite) SetUpSuite(c *gc.C) { 33 if runtime.GOOS == "windows" { 34 c.Skip("Skipping bridge config tests on windows") 35 } 36 s.BaseSuite.SetUpSuite(c) 37 38 for _, version := range []string{ 39 "/usr/bin/python2", 40 "/usr/bin/python3", 41 "/usr/bin/python", 42 } { 43 if _, err := os.Stat(version); err == nil { 44 s.pythonVersions = append(s.pythonVersions, version) 45 } 46 } 47 } 48 49 func (s *bridgeConfigSuite) SetUpTest(c *gc.C) { 50 // We need at least one Python package installed. 51 c.Assert(s.pythonVersions, gc.Not(gc.HasLen), 0) 52 53 s.testConfigPath = filepath.Join(c.MkDir(), "network-config") 54 s.testPythonScript = filepath.Join(c.MkDir(), bridgeScriptName) 55 s.testConfig = "# test network config\n" 56 err := ioutil.WriteFile(s.testConfigPath, []byte(s.testConfig), 0644) 57 c.Assert(err, jc.ErrorIsNil) 58 err = ioutil.WriteFile(s.testPythonScript, []byte(bridgeScriptPython), 0644) 59 c.Assert(err, jc.ErrorIsNil) 60 } 61 62 func (s *bridgeConfigSuite) assertScript(c *gc.C, initialConfig, expectedConfig, bridgePrefix, bridgeName, interfaceToBridge string) { 63 for i, python := range s.pythonVersions { 64 c.Logf("test #%v using %s", i, python) 65 // To simplify most cases, trim trailing new lines. 66 initialConfig = strings.TrimSuffix(initialConfig, "\n") 67 expectedConfig = strings.TrimSuffix(expectedConfig, "\n") 68 err := ioutil.WriteFile(s.testConfigPath, []byte(initialConfig), 0644) 69 c.Check(err, jc.ErrorIsNil) 70 // Run the script and verify the modified config. 71 output, retcode := s.runScript(c, python, s.testConfigPath, bridgePrefix, bridgeName, interfaceToBridge) 72 c.Check(retcode, gc.Equals, 0) 73 c.Check(strings.Trim(output, "\n"), gc.Equals, expectedConfig) 74 } 75 } 76 77 func (s *bridgeConfigSuite) assertScriptWithPrefix(c *gc.C, initial, expected, prefix string) { 78 s.assertScript(c, initial, expected, prefix, "", "") 79 } 80 81 func (s *bridgeConfigSuite) assertScriptWithDefaultPrefix(c *gc.C, initial, expected string) { 82 s.assertScript(c, initial, expected, "", "", "") 83 } 84 85 func (s *bridgeConfigSuite) assertScriptWithoutPrefix(c *gc.C, initial, expected, bridgeName, interfaceToBridge string) { 86 s.assertScript(c, initial, expected, "", bridgeName, interfaceToBridge) 87 } 88 89 func (s *bridgeConfigSuite) TestBridgeScriptWithUndefinedArgs(c *gc.C) { 90 for i, python := range s.pythonVersions { 91 c.Logf("test #%v using %s", i, python) 92 _, code := s.runScript(c, python, "", "", "", "") 93 c.Check(code, gc.Equals, 1) 94 } 95 } 96 97 func (s *bridgeConfigSuite) TestBridgeScriptWithPrefixTransformation(c *gc.C) { 98 for i, v := range []struct { 99 initial string 100 expected string 101 prefix string 102 }{ 103 {networkDHCPInitial, networkDHCPExpected, "test-br-"}, 104 {networkDHCPWithAliasInitial, networkDHCPWithAliasExpected, "test-br-"}, 105 {networkDHCPWithBondInitial, networkDHCPWithBondExpected, "test-br-"}, 106 {networkDualNICInitial, networkDualNICExpected, "test-br-"}, 107 {networkMultipleAliasesInitial, networkMultipleAliasesExpected, "test-br-"}, 108 {networkMultipleStaticWithAliasesInitial, networkMultipleStaticWithAliasesExpected, "test-br-"}, 109 {networkSmorgasboardInitial, networkSmorgasboardExpected, "juju-br-"}, 110 {networkStaticInitial, networkStaticExpected, "test-br-"}, 111 {networkVLANInitial, networkVLANExpected, "vlan-br-"}, 112 {networkWithAliasInitial, networkWithAliasExpected, "test-br-"}, 113 } { 114 c.Logf("test #%v - expected transformation", i) 115 s.assertScriptWithPrefix(c, v.initial, v.expected, v.prefix) 116 c.Logf("test #%v - idempotent transformation", i) 117 s.assertScriptWithPrefix(c, v.expected, v.expected, v.prefix) 118 } 119 } 120 121 func (s *bridgeConfigSuite) TestBridgeScriptWithDefaultPrefixTransformation(c *gc.C) { 122 for i, v := range []struct { 123 initial string 124 expected string 125 }{ 126 {networkLoopbackOnlyInitial, networkLoopbackOnlyExpected}, 127 {networkStaticBondWithVLANsInitial, networkStaticBondWithVLANsExpected}, 128 {networkVLANWithActiveDHCPDeviceInitial, networkVLANWithActiveDHCPDeviceExpected}, 129 {networkVLANWithInactiveDeviceInitial, networkVLANWithInactiveDeviceExpected}, 130 {networkVLANWithMultipleNameserversInitial, networkVLANWithMultipleNameserversExpected}, 131 {networkWithEmptyDNSValuesInitial, networkWithEmptyDNSValuesExpected}, 132 {networkWithMultipleDNSValuesInitial, networkWithMultipleDNSValuesExpected}, 133 {networkPartiallyBridgedInitial, networkPartiallyBridgedExpected}, 134 } { 135 c.Logf("test #%v - expected transformation", i) 136 s.assertScriptWithDefaultPrefix(c, v.initial, v.expected) 137 c.Logf("test #%v - idempotent transformation", i) 138 s.assertScriptWithDefaultPrefix(c, v.expected, v.expected) 139 } 140 } 141 142 func (s *bridgeConfigSuite) TestBridgeScriptInterfaceNameArgumentRequired(c *gc.C) { 143 for i, python := range s.pythonVersions { 144 c.Logf("test #%v using %s", i, python) 145 output, code := s.runScript(c, python, "# no content", "", "juju-br0", "") 146 c.Check(code, gc.Equals, 1) 147 c.Check(strings.Trim(output, "\n"), gc.Equals, "error: --interface-to-bridge required when using --bridge-name") 148 } 149 } 150 151 func (s *bridgeConfigSuite) TestBridgeScriptBridgeNameArgumentRequired(c *gc.C) { 152 for i, python := range s.pythonVersions { 153 c.Logf("test #%v using %s", i, python) 154 output, code := s.runScript(c, python, "# no content", "", "", "eth0") 155 c.Check(code, gc.Equals, 1) 156 c.Check(strings.Trim(output, "\n"), gc.Equals, "error: --bridge-name required when using --interface-to-bridge") 157 } 158 } 159 160 func (s *bridgeConfigSuite) TestBridgeScriptMatchingNonExistentSpecificIface(c *gc.C) { 161 s.assertScriptWithoutPrefix(c, networkStaticInitial, networkStaticInitial, "juju-br0", "eth1234567890") 162 } 163 164 func (s *bridgeConfigSuite) TestBridgeScriptMatchingExistingSpecificIfaceButMissingAutoStanza(c *gc.C) { 165 s.assertScriptWithoutPrefix(c, networkWithExistingSpecificIfaceInitial, networkWithExistingSpecificIfaceExpected, "juju-br0", "eth1") 166 } 167 168 func (s *bridgeConfigSuite) TestBridgeScriptMatchingExistingSpecificIface2(c *gc.C) { 169 s.assertScriptWithoutPrefix(c, networkLP1532167Initial, networkLP1532167Expected, "juju-br0", "bond0") 170 } 171 172 func (s *bridgeConfigSuite) runScript(c *gc.C, pythonBinary, configFile, bridgePrefix, bridgeName, interfaceToBridge string) (output string, exitCode int) { 173 if bridgePrefix != "" { 174 bridgePrefix = fmt.Sprintf("--bridge-prefix=%q", bridgePrefix) 175 } 176 177 if bridgeName != "" { 178 bridgeName = fmt.Sprintf("--bridge-name=%q", bridgeName) 179 } 180 181 if interfaceToBridge != "" { 182 interfaceToBridge = fmt.Sprintf("--interface-to-bridge=%q", interfaceToBridge) 183 } 184 185 script := fmt.Sprintf("%q %q %s %s %s %q\n", pythonBinary, s.testPythonScript, bridgePrefix, bridgeName, interfaceToBridge, configFile) 186 c.Log(script) 187 result, err := exec.RunCommands(exec.RunParams{Commands: script}) 188 c.Assert(err, jc.ErrorIsNil, gc.Commentf("script failed unexpectedly")) 189 stdout := string(result.Stdout) 190 stderr := string(result.Stderr) 191 if stderr != "" { 192 return stdout + "\n" + stderr, result.Code 193 } 194 return stdout, result.Code 195 } 196 197 // The rest of the file contains various forms of network config for 198 // both before and after it has been run through the python script. 199 // They are used in individual test functions. 200 201 const networkStaticInitial = `auto lo 202 iface lo inet loopback 203 204 auto eth0 205 iface eth0 inet static 206 address 1.2.3.4 207 netmask 255.255.255.0 208 gateway 4.3.2.1` 209 210 const networkStaticExpected = `auto lo 211 iface lo inet loopback 212 213 iface eth0 inet manual 214 215 auto test-br-eth0 216 iface test-br-eth0 inet static 217 address 1.2.3.4 218 netmask 255.255.255.0 219 gateway 4.3.2.1 220 bridge_ports eth0 221 bridge_stp off 222 bridge_maxwait 0` 223 224 const networkDHCPInitial = `auto lo 225 iface lo inet loopback 226 227 auto eth0 228 iface eth0 inet dhcp` 229 230 const networkDHCPExpected = `auto lo 231 iface lo inet loopback 232 233 iface eth0 inet manual 234 235 auto test-br-eth0 236 iface test-br-eth0 inet dhcp 237 bridge_ports eth0 238 bridge_stp off 239 bridge_maxwait 0` 240 241 const networkDualNICInitial = `auto lo 242 iface lo inet loopback 243 244 auto eth0 245 iface eth0 inet static 246 address 1.2.3.4 247 netmask 255.255.255.0 248 gateway 4.3.2.1 249 250 auto eth1 251 iface eth1 inet static 252 address 1.2.3.5 253 netmask 255.255.255.0 254 gateway 4.3.2.1` 255 256 const networkDualNICExpected = `auto lo 257 iface lo inet loopback 258 259 iface eth0 inet manual 260 261 auto test-br-eth0 262 iface test-br-eth0 inet static 263 address 1.2.3.4 264 netmask 255.255.255.0 265 gateway 4.3.2.1 266 bridge_ports eth0 267 bridge_stp off 268 bridge_maxwait 0 269 270 iface eth1 inet manual 271 272 auto test-br-eth1 273 iface test-br-eth1 inet static 274 address 1.2.3.5 275 netmask 255.255.255.0 276 gateway 4.3.2.1 277 bridge_ports eth1 278 bridge_stp off 279 bridge_maxwait 0` 280 281 const networkWithAliasInitial = `auto lo 282 iface lo inet loopback 283 284 auto eth0 285 iface eth0 inet static 286 address 1.2.3.4 287 netmask 255.255.255.0 288 gateway 4.3.2.1 289 290 auto eth0:1 291 iface eth0:1 inet static 292 address 1.2.3.5` 293 294 const networkWithAliasExpected = `auto lo 295 iface lo inet loopback 296 297 iface eth0 inet manual 298 299 auto test-br-eth0 300 iface test-br-eth0 inet static 301 address 1.2.3.4 302 netmask 255.255.255.0 303 gateway 4.3.2.1 304 bridge_ports eth0 305 bridge_stp off 306 bridge_maxwait 0 307 308 auto eth0:1 309 iface eth0:1 inet static 310 address 1.2.3.5` 311 312 const networkDHCPWithAliasInitial = `auto lo 313 iface lo inet loopback 314 315 auto eth0 316 iface eth0 inet static 317 gateway 10.14.0.1 318 address 10.14.0.102/24 319 320 auto eth0:1 321 iface eth0:1 inet static 322 address 10.14.0.103/24 323 324 auto eth0:2 325 iface eth0:2 inet static 326 address 10.14.0.100/24 327 328 dns-nameserver 192.168.1.142` 329 330 const networkDHCPWithAliasExpected = `auto lo 331 iface lo inet loopback 332 333 iface eth0 inet manual 334 335 auto test-br-eth0 336 iface test-br-eth0 inet static 337 gateway 10.14.0.1 338 address 10.14.0.102/24 339 bridge_ports eth0 340 bridge_stp off 341 bridge_maxwait 0 342 343 auto eth0:1 344 iface eth0:1 inet static 345 address 10.14.0.103/24 346 347 auto eth0:2 348 iface eth0:2 inet static 349 address 10.14.0.100/24 350 dns-nameserver 192.168.1.142` 351 352 const networkMultipleStaticWithAliasesInitial = ` 353 auto eth0 354 iface eth0 inet static 355 gateway 10.17.20.1 356 address 10.17.20.201/24 357 mtu 1500 358 359 auto eth0:1 360 iface eth0:1 inet static 361 address 10.17.20.202/24 362 mtu 1500 363 364 auto eth1 365 iface eth1 inet manual 366 mtu 1500 367 368 dns-nameservers 10.17.20.200 369 dns-search maas` 370 371 const networkMultipleStaticWithAliasesExpected = `iface eth0 inet manual 372 373 auto test-br-eth0 374 iface test-br-eth0 inet static 375 gateway 10.17.20.1 376 address 10.17.20.201/24 377 mtu 1500 378 bridge_ports eth0 379 bridge_stp off 380 bridge_maxwait 0 381 382 auto eth0:1 383 iface eth0:1 inet static 384 address 10.17.20.202/24 385 mtu 1500 386 387 auto eth1 388 iface eth1 inet manual 389 mtu 1500 390 dns-nameservers 10.17.20.200 391 dns-search maas` 392 393 const networkDHCPWithBondInitial = `auto eth0 394 iface eth0 inet manual 395 bond-lacp_rate slow 396 bond-xmit_hash_policy layer2 397 bond-miimon 100 398 bond-master bond0 399 mtu 1500 400 bond-mode active-backup 401 402 auto eth1 403 iface eth1 inet manual 404 bond-lacp_rate slow 405 bond-xmit_hash_policy layer2 406 bond-miimon 100 407 bond-master bond0 408 mtu 1500 409 bond-mode active-backup 410 411 auto bond0 412 iface bond0 inet dhcp 413 bond-lacp_rate slow 414 bond-xmit_hash_policy layer2 415 bond-miimon 100 416 mtu 1500 417 bond-mode active-backup 418 hwaddress 52:54:00:1c:f1:5b 419 bond-slaves none 420 421 dns-nameservers 10.17.20.200 422 dns-search maas19` 423 424 const networkDHCPWithBondExpected = `auto eth0 425 iface eth0 inet manual 426 bond-lacp_rate slow 427 bond-xmit_hash_policy layer2 428 bond-miimon 100 429 bond-master bond0 430 mtu 1500 431 bond-mode active-backup 432 433 auto eth1 434 iface eth1 inet manual 435 bond-lacp_rate slow 436 bond-xmit_hash_policy layer2 437 bond-miimon 100 438 bond-master bond0 439 mtu 1500 440 bond-mode active-backup 441 442 auto bond0 443 iface bond0 inet manual 444 bond-lacp_rate slow 445 bond-xmit_hash_policy layer2 446 bond-miimon 100 447 mtu 1500 448 bond-mode active-backup 449 hwaddress 52:54:00:1c:f1:5b 450 bond-slaves none 451 dns-nameservers 10.17.20.200 452 dns-search maas19 453 454 auto test-br-bond0 455 iface test-br-bond0 inet dhcp 456 mtu 1500 457 hwaddress 52:54:00:1c:f1:5b 458 bridge_ports bond0 459 bridge_stp off 460 bridge_maxwait 0 461 dns-nameservers 10.17.20.200 462 dns-search maas19` 463 464 const networkMultipleAliasesInitial = `auto eth0 465 iface eth0 inet dhcp 466 467 auto eth1 468 iface eth1 inet dhcp 469 470 auto eth10 471 iface eth10 inet static 472 gateway 10.17.20.1 473 address 10.17.20.201/24 474 mtu 1500 475 476 auto eth10:1 477 iface eth10:1 inet static 478 address 10.17.20.202/24 479 mtu 1500 480 481 auto eth10:2 482 iface eth10:2 inet static 483 address 10.17.20.203/24 484 mtu 1500 485 486 dns-nameservers 10.17.20.200 487 dns-search maas19` 488 489 const networkMultipleAliasesExpected = `iface eth0 inet manual 490 491 auto test-br-eth0 492 iface test-br-eth0 inet dhcp 493 bridge_ports eth0 494 bridge_stp off 495 bridge_maxwait 0 496 497 iface eth1 inet manual 498 499 auto test-br-eth1 500 iface test-br-eth1 inet dhcp 501 bridge_ports eth1 502 bridge_stp off 503 bridge_maxwait 0 504 505 iface eth10 inet manual 506 507 auto test-br-eth10 508 iface test-br-eth10 inet static 509 gateway 10.17.20.1 510 address 10.17.20.201/24 511 mtu 1500 512 bridge_ports eth10 513 bridge_stp off 514 bridge_maxwait 0 515 516 auto eth10:1 517 iface eth10:1 inet static 518 address 10.17.20.202/24 519 mtu 1500 520 521 auto eth10:2 522 iface eth10:2 inet static 523 address 10.17.20.203/24 524 mtu 1500 525 dns-nameservers 10.17.20.200 526 dns-search maas19` 527 528 const networkSmorgasboardInitial = `auto eth0 529 iface eth0 inet manual 530 bond-lacp_rate slow 531 bond-xmit_hash_policy layer2 532 bond-miimon 100 533 bond-master bond0 534 mtu 1500 535 bond-mode active-backup 536 537 auto eth1 538 iface eth1 inet manual 539 bond-lacp_rate slow 540 bond-xmit_hash_policy layer2 541 bond-miimon 100 542 bond-master bond0 543 mtu 1500 544 bond-mode active-backup 545 546 auto eth2 547 iface eth2 inet manual 548 bond-lacp_rate slow 549 bond-xmit_hash_policy layer2 550 bond-miimon 100 551 bond-master bond1 552 mtu 1500 553 bond-mode active-backup 554 555 auto eth3 556 iface eth3 inet manual 557 bond-lacp_rate slow 558 bond-xmit_hash_policy layer2 559 bond-miimon 100 560 bond-master bond1 561 mtu 1500 562 bond-mode active-backup 563 564 auto eth4 565 iface eth4 inet static 566 address 10.17.20.202/24 567 mtu 1500 568 569 auto eth5 570 iface eth5 inet dhcp 571 mtu 1500 572 573 auto eth6 574 iface eth6 inet static 575 address 10.17.20.203/24 576 mtu 1500 577 578 auto eth6:1 579 iface eth6:1 inet static 580 address 10.17.20.205/24 581 mtu 1500 582 583 auto eth6:2 584 iface eth6:2 inet static 585 address 10.17.20.204/24 586 mtu 1500 587 588 auto eth6:3 589 iface eth6:3 inet static 590 address 10.17.20.206/24 591 mtu 1500 592 593 auto eth6:4 594 iface eth6:4 inet static 595 address 10.17.20.207/24 596 mtu 1500 597 598 auto bond0 599 iface bond0 inet static 600 gateway 10.17.20.1 601 address 10.17.20.201/24 602 bond-lacp_rate slow 603 bond-xmit_hash_policy layer2 604 bond-miimon 100 605 mtu 1500 606 bond-mode active-backup 607 hwaddress 52:54:00:6a:4f:fd 608 bond-slaves none 609 610 auto bond1 611 iface bond1 inet dhcp 612 bond-lacp_rate slow 613 bond-xmit_hash_policy layer2 614 bond-miimon 100 615 mtu 1500 616 bond-mode active-backup 617 hwaddress 52:54:00:8e:6e:b0 618 bond-slaves none 619 620 dns-nameservers 10.17.20.200 621 dns-search maas19` 622 623 const networkSmorgasboardExpected = `auto eth0 624 iface eth0 inet manual 625 bond-lacp_rate slow 626 bond-xmit_hash_policy layer2 627 bond-miimon 100 628 bond-master bond0 629 mtu 1500 630 bond-mode active-backup 631 632 auto eth1 633 iface eth1 inet manual 634 bond-lacp_rate slow 635 bond-xmit_hash_policy layer2 636 bond-miimon 100 637 bond-master bond0 638 mtu 1500 639 bond-mode active-backup 640 641 auto eth2 642 iface eth2 inet manual 643 bond-lacp_rate slow 644 bond-xmit_hash_policy layer2 645 bond-miimon 100 646 bond-master bond1 647 mtu 1500 648 bond-mode active-backup 649 650 auto eth3 651 iface eth3 inet manual 652 bond-lacp_rate slow 653 bond-xmit_hash_policy layer2 654 bond-miimon 100 655 bond-master bond1 656 mtu 1500 657 bond-mode active-backup 658 659 iface eth4 inet manual 660 661 auto juju-br-eth4 662 iface juju-br-eth4 inet static 663 address 10.17.20.202/24 664 mtu 1500 665 bridge_ports eth4 666 bridge_stp off 667 bridge_maxwait 0 668 669 iface eth5 inet manual 670 671 auto juju-br-eth5 672 iface juju-br-eth5 inet dhcp 673 mtu 1500 674 bridge_ports eth5 675 bridge_stp off 676 bridge_maxwait 0 677 678 iface eth6 inet manual 679 680 auto juju-br-eth6 681 iface juju-br-eth6 inet static 682 address 10.17.20.203/24 683 mtu 1500 684 bridge_ports eth6 685 bridge_stp off 686 bridge_maxwait 0 687 688 auto eth6:1 689 iface eth6:1 inet static 690 address 10.17.20.205/24 691 mtu 1500 692 693 auto eth6:2 694 iface eth6:2 inet static 695 address 10.17.20.204/24 696 mtu 1500 697 698 auto eth6:3 699 iface eth6:3 inet static 700 address 10.17.20.206/24 701 mtu 1500 702 703 auto eth6:4 704 iface eth6:4 inet static 705 address 10.17.20.207/24 706 mtu 1500 707 708 auto bond0 709 iface bond0 inet manual 710 gateway 10.17.20.1 711 address 10.17.20.201/24 712 bond-lacp_rate slow 713 bond-xmit_hash_policy layer2 714 bond-miimon 100 715 mtu 1500 716 bond-mode active-backup 717 hwaddress 52:54:00:6a:4f:fd 718 bond-slaves none 719 720 auto juju-br-bond0 721 iface juju-br-bond0 inet static 722 gateway 10.17.20.1 723 address 10.17.20.201/24 724 mtu 1500 725 hwaddress 52:54:00:6a:4f:fd 726 bridge_ports bond0 727 bridge_stp off 728 bridge_maxwait 0 729 730 auto bond1 731 iface bond1 inet manual 732 bond-lacp_rate slow 733 bond-xmit_hash_policy layer2 734 bond-miimon 100 735 mtu 1500 736 bond-mode active-backup 737 hwaddress 52:54:00:8e:6e:b0 738 bond-slaves none 739 dns-nameservers 10.17.20.200 740 dns-search maas19 741 742 auto juju-br-bond1 743 iface juju-br-bond1 inet dhcp 744 mtu 1500 745 hwaddress 52:54:00:8e:6e:b0 746 bridge_ports bond1 747 bridge_stp off 748 bridge_maxwait 0 749 dns-nameservers 10.17.20.200 750 dns-search maas19` 751 752 const networkVLANInitial = `auto eth0 753 iface eth0 inet static 754 gateway 10.17.20.1 755 address 10.17.20.212/24 756 mtu 1500 757 758 auto eth1 759 iface eth1 inet manual 760 mtu 1500 761 762 auto eth0.2 763 iface eth0.2 inet static 764 address 192.168.2.3/24 765 vlan-raw-device eth0 766 mtu 1500 767 vlan_id 2 768 769 auto eth1.3 770 iface eth1.3 inet static 771 address 192.168.3.3/24 772 vlan-raw-device eth1 773 mtu 1500 774 vlan_id 3 775 776 dns-nameservers 10.17.20.200 777 dns-search maas19` 778 779 const networkVLANExpected = `iface eth0 inet manual 780 781 auto vlan-br-eth0 782 iface vlan-br-eth0 inet static 783 gateway 10.17.20.1 784 address 10.17.20.212/24 785 mtu 1500 786 bridge_ports eth0 787 bridge_stp off 788 bridge_maxwait 0 789 790 auto eth1 791 iface eth1 inet manual 792 mtu 1500 793 794 iface eth0.2 inet manual 795 address 192.168.2.3/24 796 vlan-raw-device eth0 797 mtu 1500 798 vlan_id 2 799 800 auto vlan-br-eth0.2 801 iface vlan-br-eth0.2 inet static 802 address 192.168.2.3/24 803 mtu 1500 804 bridge_ports eth0.2 805 bridge_stp off 806 bridge_maxwait 0 807 808 iface eth1.3 inet manual 809 address 192.168.3.3/24 810 vlan-raw-device eth1 811 mtu 1500 812 vlan_id 3 813 dns-nameservers 10.17.20.200 814 dns-search maas19 815 816 auto vlan-br-eth1.3 817 iface vlan-br-eth1.3 inet static 818 address 192.168.3.3/24 819 mtu 1500 820 bridge_ports eth1.3 821 bridge_stp off 822 bridge_maxwait 0 823 dns-nameservers 10.17.20.200 824 dns-search maas19` 825 826 const networkVLANWithMultipleNameserversInitial = `auto eth0 827 iface eth0 inet static 828 dns-nameservers 10.245.168.2 829 gateway 10.245.168.1 830 address 10.245.168.11/21 831 mtu 1500 832 833 auto eth1 834 iface eth1 inet manual 835 mtu 1500 836 837 auto eth2 838 iface eth2 inet manual 839 mtu 1500 840 841 auto eth3 842 iface eth3 inet manual 843 mtu 1500 844 845 auto eth1.2667 846 iface eth1.2667 inet static 847 dns-nameservers 10.245.168.2 848 address 10.245.184.2/24 849 vlan-raw-device eth1 850 mtu 1500 851 vlan_id 2667 852 853 auto eth1.2668 854 iface eth1.2668 inet static 855 dns-nameservers 10.245.168.2 856 address 10.245.185.1/24 857 vlan-raw-device eth1 858 mtu 1500 859 vlan_id 2668 860 861 auto eth1.2669 862 iface eth1.2669 inet static 863 dns-nameservers 10.245.168.2 864 address 10.245.186.1/24 865 vlan-raw-device eth1 866 mtu 1500 867 vlan_id 2669 868 869 auto eth1.2670 870 iface eth1.2670 inet static 871 dns-nameservers 10.245.168.2 872 address 10.245.187.2/24 873 vlan-raw-device eth1 874 mtu 1500 875 vlan_id 2670 876 877 dns-nameservers 10.245.168.2 878 dns-search dellstack` 879 880 const networkVLANWithMultipleNameserversExpected = `iface eth0 inet manual 881 882 auto br-eth0 883 iface br-eth0 inet static 884 gateway 10.245.168.1 885 address 10.245.168.11/21 886 mtu 1500 887 bridge_ports eth0 888 bridge_stp off 889 bridge_maxwait 0 890 dns-nameservers 10.245.168.2 891 892 auto eth1 893 iface eth1 inet manual 894 mtu 1500 895 896 auto eth2 897 iface eth2 inet manual 898 mtu 1500 899 900 auto eth3 901 iface eth3 inet manual 902 mtu 1500 903 904 iface eth1.2667 inet manual 905 address 10.245.184.2/24 906 vlan-raw-device eth1 907 mtu 1500 908 vlan_id 2667 909 dns-nameservers 10.245.168.2 910 911 auto br-eth1.2667 912 iface br-eth1.2667 inet static 913 address 10.245.184.2/24 914 mtu 1500 915 bridge_ports eth1.2667 916 bridge_stp off 917 bridge_maxwait 0 918 dns-nameservers 10.245.168.2 919 920 iface eth1.2668 inet manual 921 address 10.245.185.1/24 922 vlan-raw-device eth1 923 mtu 1500 924 vlan_id 2668 925 dns-nameservers 10.245.168.2 926 927 auto br-eth1.2668 928 iface br-eth1.2668 inet static 929 address 10.245.185.1/24 930 mtu 1500 931 bridge_ports eth1.2668 932 bridge_stp off 933 bridge_maxwait 0 934 dns-nameservers 10.245.168.2 935 936 iface eth1.2669 inet manual 937 address 10.245.186.1/24 938 vlan-raw-device eth1 939 mtu 1500 940 vlan_id 2669 941 dns-nameservers 10.245.168.2 942 943 auto br-eth1.2669 944 iface br-eth1.2669 inet static 945 address 10.245.186.1/24 946 mtu 1500 947 bridge_ports eth1.2669 948 bridge_stp off 949 bridge_maxwait 0 950 dns-nameservers 10.245.168.2 951 952 iface eth1.2670 inet manual 953 address 10.245.187.2/24 954 vlan-raw-device eth1 955 mtu 1500 956 vlan_id 2670 957 dns-nameservers 10.245.168.2 958 dns-search dellstack 959 960 auto br-eth1.2670 961 iface br-eth1.2670 inet static 962 address 10.245.187.2/24 963 mtu 1500 964 bridge_ports eth1.2670 965 bridge_stp off 966 bridge_maxwait 0 967 dns-nameservers 10.245.168.2 968 dns-search dellstack` 969 970 const networkLoopbackOnlyInitial = `auto lo 971 iface lo inet loopback` 972 973 const networkLoopbackOnlyExpected = `auto lo 974 iface lo inet loopback` 975 976 const networkStaticBondWithVLANsInitial = `auto eth0 977 iface eth0 inet manual 978 bond-master bond0 979 bond-mode active-backup 980 bond-xmit_hash_policy layer2 981 bond-miimon 100 982 mtu 1500 983 bond-lacp_rate slow 984 985 auto eth1 986 iface eth1 inet manual 987 bond-master bond0 988 bond-mode active-backup 989 bond-xmit_hash_policy layer2 990 bond-miimon 100 991 mtu 1500 992 bond-lacp_rate slow 993 994 auto bond0 995 iface bond0 inet static 996 address 10.17.20.211/24 997 gateway 10.17.20.1 998 dns-nameservers 10.17.20.200 999 bond-slaves none 1000 bond-mode active-backup 1001 bond-xmit_hash_policy layer2 1002 bond-miimon 100 1003 mtu 1500 1004 hwaddress 52:54:00:1c:f1:5b 1005 bond-lacp_rate slow 1006 1007 auto bond0.2 1008 iface bond0.2 inet static 1009 address 192.168.2.102/24 1010 vlan-raw-device bond0 1011 mtu 1500 1012 vlan_id 2 1013 1014 auto bond0.3 1015 iface bond0.3 inet static 1016 address 192.168.3.101/24 1017 vlan-raw-device bond0 1018 mtu 1500 1019 vlan_id 3 1020 1021 dns-nameservers 10.17.20.200 1022 dns-search maas19` 1023 1024 const networkStaticBondWithVLANsExpected = `auto eth0 1025 iface eth0 inet manual 1026 bond-master bond0 1027 bond-mode active-backup 1028 bond-xmit_hash_policy layer2 1029 bond-miimon 100 1030 mtu 1500 1031 bond-lacp_rate slow 1032 1033 auto eth1 1034 iface eth1 inet manual 1035 bond-master bond0 1036 bond-mode active-backup 1037 bond-xmit_hash_policy layer2 1038 bond-miimon 100 1039 mtu 1500 1040 bond-lacp_rate slow 1041 1042 auto bond0 1043 iface bond0 inet manual 1044 address 10.17.20.211/24 1045 gateway 10.17.20.1 1046 bond-slaves none 1047 bond-mode active-backup 1048 bond-xmit_hash_policy layer2 1049 bond-miimon 100 1050 mtu 1500 1051 hwaddress 52:54:00:1c:f1:5b 1052 bond-lacp_rate slow 1053 dns-nameservers 10.17.20.200 1054 1055 auto br-bond0 1056 iface br-bond0 inet static 1057 address 10.17.20.211/24 1058 gateway 10.17.20.1 1059 mtu 1500 1060 hwaddress 52:54:00:1c:f1:5b 1061 bridge_ports bond0 1062 bridge_stp off 1063 bridge_maxwait 0 1064 dns-nameservers 10.17.20.200 1065 1066 iface bond0.2 inet manual 1067 address 192.168.2.102/24 1068 vlan-raw-device bond0 1069 mtu 1500 1070 vlan_id 2 1071 1072 auto br-bond0.2 1073 iface br-bond0.2 inet static 1074 address 192.168.2.102/24 1075 mtu 1500 1076 bridge_ports bond0.2 1077 bridge_stp off 1078 bridge_maxwait 0 1079 1080 iface bond0.3 inet manual 1081 address 192.168.3.101/24 1082 vlan-raw-device bond0 1083 mtu 1500 1084 vlan_id 3 1085 dns-nameservers 10.17.20.200 1086 dns-search maas19 1087 1088 auto br-bond0.3 1089 iface br-bond0.3 inet static 1090 address 192.168.3.101/24 1091 mtu 1500 1092 bridge_ports bond0.3 1093 bridge_stp off 1094 bridge_maxwait 0 1095 dns-nameservers 10.17.20.200 1096 dns-search maas19` 1097 1098 const networkVLANWithInactiveDeviceInitial = `auto eth0 1099 iface eth0 inet static 1100 dns-nameservers 10.17.20.200 1101 gateway 10.17.20.1 1102 address 10.17.20.211/24 1103 mtu 1500 1104 1105 auto eth1 1106 iface eth1 inet manual 1107 mtu 1500 1108 1109 auto eth1.2 1110 iface eth1.2 inet dhcp 1111 vlan-raw-device eth1 1112 mtu 1500 1113 vlan_id 2 1114 1115 dns-nameservers 10.17.20.200 1116 dns-search maas19 1117 ` 1118 1119 const networkVLANWithInactiveDeviceExpected = `iface eth0 inet manual 1120 1121 auto br-eth0 1122 iface br-eth0 inet static 1123 gateway 10.17.20.1 1124 address 10.17.20.211/24 1125 mtu 1500 1126 bridge_ports eth0 1127 bridge_stp off 1128 bridge_maxwait 0 1129 dns-nameservers 10.17.20.200 1130 1131 auto eth1 1132 iface eth1 inet manual 1133 mtu 1500 1134 1135 iface eth1.2 inet manual 1136 vlan-raw-device eth1 1137 mtu 1500 1138 vlan_id 2 1139 dns-nameservers 10.17.20.200 1140 dns-search maas19 1141 1142 auto br-eth1.2 1143 iface br-eth1.2 inet dhcp 1144 mtu 1500 1145 bridge_ports eth1.2 1146 bridge_stp off 1147 bridge_maxwait 0 1148 dns-nameservers 10.17.20.200 1149 dns-search maas19` 1150 1151 const networkVLANWithActiveDHCPDeviceInitial = `auto eth0 1152 iface eth0 inet static 1153 dns-nameservers 10.17.20.200 1154 gateway 10.17.20.1 1155 address 10.17.20.211/24 1156 mtu 1500 1157 1158 auto eth1 1159 iface eth1 inet dhcp 1160 mtu 1500 1161 1162 auto eth1.2 1163 iface eth1.2 inet dhcp 1164 vlan-raw-device eth1 1165 mtu 1500 1166 vlan_id 2 1167 1168 dns-nameservers 10.17.20.200 1169 dns-search maas19 1170 ` 1171 1172 const networkVLANWithActiveDHCPDeviceExpected = `iface eth0 inet manual 1173 1174 auto br-eth0 1175 iface br-eth0 inet static 1176 gateway 10.17.20.1 1177 address 10.17.20.211/24 1178 mtu 1500 1179 bridge_ports eth0 1180 bridge_stp off 1181 bridge_maxwait 0 1182 dns-nameservers 10.17.20.200 1183 1184 iface eth1 inet manual 1185 1186 auto br-eth1 1187 iface br-eth1 inet dhcp 1188 mtu 1500 1189 bridge_ports eth1 1190 bridge_stp off 1191 bridge_maxwait 0 1192 1193 iface eth1.2 inet manual 1194 vlan-raw-device eth1 1195 mtu 1500 1196 vlan_id 2 1197 dns-nameservers 10.17.20.200 1198 dns-search maas19 1199 1200 auto br-eth1.2 1201 iface br-eth1.2 inet dhcp 1202 mtu 1500 1203 bridge_ports eth1.2 1204 bridge_stp off 1205 bridge_maxwait 0 1206 dns-nameservers 10.17.20.200 1207 dns-search maas19` 1208 1209 const networkWithMultipleDNSValuesInitial = `auto eth0 1210 iface eth0 inet static 1211 dns-nameservers 10.245.168.2 1212 gateway 10.245.168.1 1213 address 10.245.168.11/21 1214 mtu 1500 1215 dns-nameservers 192.168.1.1 1216 dns-nameservers 10.245.168.2 192.168.1.1 10.245.168.2 1217 1218 auto eth1 1219 iface eth1 inet static 1220 gateway 10.245.168.1 1221 address 10.245.168.12/21 1222 mtu 1500 1223 dns-sortlist 192.168.1.0/24 10.245.168.0/21 192.168.1.0/24 1224 dns-sortlist 10.245.168.0/21 192.168.1.0/24 1225 1226 auto eth2 1227 iface eth2 inet static 1228 gateway 10.245.168.1 1229 address 10.245.168.13/21 1230 mtu 1500 1231 dns-search juju ubuntu 1232 dns-search dellstack ubuntu dellstack 1233 1234 auto eth3 1235 iface eth3 inet static 1236 gateway 10.245.168.1 1237 address 10.245.168.14/21 1238 mtu 1500 1239 dns-nameservers 192.168.1.1 1240 dns-nameservers 10.245.168.2 192.168.1.1 10.245.168.2 1241 dns-sortlist 192.168.1.0/24 10.245.168.0/21 192.168.1.0/24 1242 dns-sortlist 10.245.168.0/21 192.168.1.0/24 1243 dns-search juju ubuntu 1244 dns-search dellstack ubuntu dellstack 1245 1246 dns-search ubuntu juju 1247 dns-search dellstack ubuntu dellstack` 1248 1249 const networkWithMultipleDNSValuesExpected = `iface eth0 inet manual 1250 1251 auto br-eth0 1252 iface br-eth0 inet static 1253 gateway 10.245.168.1 1254 address 10.245.168.11/21 1255 mtu 1500 1256 bridge_ports eth0 1257 bridge_stp off 1258 bridge_maxwait 0 1259 dns-nameservers 10.245.168.2 192.168.1.1 1260 1261 iface eth1 inet manual 1262 1263 auto br-eth1 1264 iface br-eth1 inet static 1265 gateway 10.245.168.1 1266 address 10.245.168.12/21 1267 mtu 1500 1268 bridge_ports eth1 1269 bridge_stp off 1270 bridge_maxwait 0 1271 dns-sortlist 192.168.1.0/24 10.245.168.0/21 1272 1273 iface eth2 inet manual 1274 1275 auto br-eth2 1276 iface br-eth2 inet static 1277 gateway 10.245.168.1 1278 address 10.245.168.13/21 1279 mtu 1500 1280 bridge_ports eth2 1281 bridge_stp off 1282 bridge_maxwait 0 1283 dns-search juju ubuntu dellstack 1284 1285 iface eth3 inet manual 1286 1287 auto br-eth3 1288 iface br-eth3 inet static 1289 gateway 10.245.168.1 1290 address 10.245.168.14/21 1291 mtu 1500 1292 bridge_ports eth3 1293 bridge_stp off 1294 bridge_maxwait 0 1295 dns-nameservers 192.168.1.1 10.245.168.2 1296 dns-search juju ubuntu dellstack 1297 dns-sortlist 192.168.1.0/24 10.245.168.0/21` 1298 1299 const networkWithEmptyDNSValuesInitial = `auto eth0 1300 iface eth0 inet static 1301 dns-nameservers 1302 dns-search 1303 dns-sortlist 1304 gateway 10.245.168.1 1305 address 10.245.168.11/21 1306 mtu 1500 1307 1308 auto eth1 1309 iface eth1 inet static 1310 dns-nameservers 1311 dns-search 1312 dns-sortlist 1313 gateway 10.245.168.1 1314 address 10.245.168.12/21 1315 mtu 1500 1316 1317 dns-nameservers 1318 dns-search 1319 dns-sortlist` 1320 1321 const networkWithEmptyDNSValuesExpected = `iface eth0 inet manual 1322 1323 auto br-eth0 1324 iface br-eth0 inet static 1325 gateway 10.245.168.1 1326 address 10.245.168.11/21 1327 mtu 1500 1328 bridge_ports eth0 1329 bridge_stp off 1330 bridge_maxwait 0 1331 1332 iface eth1 inet manual 1333 1334 auto br-eth1 1335 iface br-eth1 inet static 1336 gateway 10.245.168.1 1337 address 10.245.168.12/21 1338 mtu 1500 1339 bridge_ports eth1 1340 bridge_stp off 1341 bridge_maxwait 0` 1342 1343 const networkLP1532167Initial = `auto eth0 1344 iface eth0 inet manual 1345 bond-lacp_rate fast 1346 bond-xmit_hash_policy layer2+3 1347 bond-miimon 100 1348 bond-master bond0 1349 mtu 1500 1350 bond-mode 802.3ad 1351 1352 auto eth1 1353 iface eth1 inet manual 1354 bond-lacp_rate fast 1355 bond-xmit_hash_policy layer2+3 1356 bond-miimon 100 1357 bond-master bond0 1358 mtu 1500 1359 bond-mode 802.3ad 1360 1361 auto eth2 1362 iface eth2 inet manual 1363 bond-lacp_rate fast 1364 bond-xmit_hash_policy layer2+3 1365 bond-miimon 100 1366 bond-master bond1 1367 mtu 1500 1368 bond-mode 802.3ad 1369 1370 auto eth3 1371 iface eth3 inet manual 1372 bond-lacp_rate fast 1373 bond-xmit_hash_policy layer2+3 1374 bond-miimon 100 1375 bond-master bond1 1376 mtu 1500 1377 bond-mode 802.3ad 1378 1379 auto bond0 1380 iface bond0 inet static 1381 gateway 10.38.160.1 1382 address 10.38.160.24/24 1383 bond-lacp_rate fast 1384 bond-xmit_hash_policy layer2+3 1385 bond-miimon 100 1386 mtu 1500 1387 bond-mode 802.3ad 1388 hwaddress 44:a8:42:41:ab:37 1389 bond-slaves none 1390 1391 auto bond1 1392 iface bond1 inet manual 1393 bond-lacp_rate fast 1394 bond-xmit_hash_policy layer2+3 1395 bond-miimon 100 1396 mtu 1500 1397 bond-mode 802.3ad 1398 hwaddress 00:0e:1e:b7:b5:50 1399 bond-slaves none 1400 1401 auto bond0.1016 1402 iface bond0.1016 inet static 1403 address 172.16.0.21/16 1404 vlan-raw-device bond0 1405 mtu 1500 1406 vlan_id 1016 1407 1408 auto bond0.161 1409 iface bond0.161 inet static 1410 address 10.38.161.21/24 1411 vlan-raw-device bond0 1412 mtu 1500 1413 vlan_id 161 1414 1415 auto bond0.162 1416 iface bond0.162 inet static 1417 address 10.38.162.21/24 1418 vlan-raw-device bond0 1419 mtu 1500 1420 vlan_id 162 1421 1422 auto bond0.163 1423 iface bond0.163 inet static 1424 address 10.38.163.21/24 1425 vlan-raw-device bond0 1426 mtu 1500 1427 vlan_id 163 1428 1429 auto bond1.1017 1430 iface bond1.1017 inet static 1431 address 172.17.0.21/16 1432 vlan-raw-device bond1 1433 mtu 1500 1434 vlan_id 1017 1435 1436 auto bond1.1018 1437 iface bond1.1018 inet static 1438 address 172.18.0.21/16 1439 vlan-raw-device bond1 1440 mtu 1500 1441 vlan_id 1018 1442 1443 auto bond1.1019 1444 iface bond1.1019 inet static 1445 address 172.19.0.21/16 1446 vlan-raw-device bond1 1447 mtu 1500 1448 vlan_id 1019 1449 1450 dns-nameservers 10.38.160.10 1451 dns-search maas` 1452 1453 const networkLP1532167Expected = `auto eth0 1454 iface eth0 inet manual 1455 bond-lacp_rate fast 1456 bond-xmit_hash_policy layer2+3 1457 bond-miimon 100 1458 bond-master bond0 1459 mtu 1500 1460 bond-mode 802.3ad 1461 1462 auto eth1 1463 iface eth1 inet manual 1464 bond-lacp_rate fast 1465 bond-xmit_hash_policy layer2+3 1466 bond-miimon 100 1467 bond-master bond0 1468 mtu 1500 1469 bond-mode 802.3ad 1470 1471 auto eth2 1472 iface eth2 inet manual 1473 bond-lacp_rate fast 1474 bond-xmit_hash_policy layer2+3 1475 bond-miimon 100 1476 bond-master bond1 1477 mtu 1500 1478 bond-mode 802.3ad 1479 1480 auto eth3 1481 iface eth3 inet manual 1482 bond-lacp_rate fast 1483 bond-xmit_hash_policy layer2+3 1484 bond-miimon 100 1485 bond-master bond1 1486 mtu 1500 1487 bond-mode 802.3ad 1488 1489 auto bond0 1490 iface bond0 inet manual 1491 gateway 10.38.160.1 1492 address 10.38.160.24/24 1493 bond-lacp_rate fast 1494 bond-xmit_hash_policy layer2+3 1495 bond-miimon 100 1496 mtu 1500 1497 bond-mode 802.3ad 1498 hwaddress 44:a8:42:41:ab:37 1499 bond-slaves none 1500 1501 auto juju-br0 1502 iface juju-br0 inet static 1503 gateway 10.38.160.1 1504 address 10.38.160.24/24 1505 mtu 1500 1506 hwaddress 44:a8:42:41:ab:37 1507 bridge_ports bond0 1508 bridge_stp off 1509 bridge_maxwait 0 1510 1511 auto bond1 1512 iface bond1 inet manual 1513 bond-lacp_rate fast 1514 bond-xmit_hash_policy layer2+3 1515 bond-miimon 100 1516 mtu 1500 1517 bond-mode 802.3ad 1518 hwaddress 00:0e:1e:b7:b5:50 1519 bond-slaves none 1520 1521 auto bond0.1016 1522 iface bond0.1016 inet static 1523 address 172.16.0.21/16 1524 vlan-raw-device bond0 1525 mtu 1500 1526 vlan_id 1016 1527 1528 auto bond0.161 1529 iface bond0.161 inet static 1530 address 10.38.161.21/24 1531 vlan-raw-device bond0 1532 mtu 1500 1533 vlan_id 161 1534 1535 auto bond0.162 1536 iface bond0.162 inet static 1537 address 10.38.162.21/24 1538 vlan-raw-device bond0 1539 mtu 1500 1540 vlan_id 162 1541 1542 auto bond0.163 1543 iface bond0.163 inet static 1544 address 10.38.163.21/24 1545 vlan-raw-device bond0 1546 mtu 1500 1547 vlan_id 163 1548 1549 auto bond1.1017 1550 iface bond1.1017 inet static 1551 address 172.17.0.21/16 1552 vlan-raw-device bond1 1553 mtu 1500 1554 vlan_id 1017 1555 1556 auto bond1.1018 1557 iface bond1.1018 inet static 1558 address 172.18.0.21/16 1559 vlan-raw-device bond1 1560 mtu 1500 1561 vlan_id 1018 1562 1563 auto bond1.1019 1564 iface bond1.1019 inet static 1565 address 172.19.0.21/16 1566 vlan-raw-device bond1 1567 mtu 1500 1568 vlan_id 1019 1569 dns-nameservers 10.38.160.10 1570 dns-search maas` 1571 1572 const networkWithExistingSpecificIfaceInitial = `auto lo 1573 iface lo inet loopback 1574 1575 # Note this has no auto stanza 1576 iface eth0 inet static 1577 address 1.2.3.4 1578 netmask 255.255.255.0 1579 gateway 4.3.2.1 1580 1581 iface eth1 inet static 1582 address 1.2.3.4 1583 netmask 255.255.255.0 1584 gateway 4.3.2.1` 1585 1586 const networkWithExistingSpecificIfaceExpected = `auto lo 1587 iface lo inet loopback 1588 1589 iface eth0 inet static 1590 address 1.2.3.4 1591 netmask 255.255.255.0 1592 gateway 4.3.2.1 1593 1594 iface eth1 inet manual 1595 1596 auto juju-br0 1597 iface juju-br0 inet static 1598 address 1.2.3.4 1599 netmask 255.255.255.0 1600 gateway 4.3.2.1 1601 bridge_ports eth1 1602 bridge_stp off 1603 bridge_maxwait 0` 1604 1605 const networkPartiallyBridgedInitial = `auto lo 1606 iface lo inet loopback 1607 1608 iface eth0 inet manual 1609 1610 auto br-eth0 1611 iface br-eth0 inet static 1612 address 1.2.3.4 1613 netmask 255.255.255.0 1614 gateway 4.3.2.1 1615 bridge_ports eth0 1616 bridge_stp off 1617 bridge_maxwait 0 1618 1619 auto eth1 1620 iface eth1 inet static 1621 address 1.2.3.5 1622 netmask 255.255.255.0 1623 gateway 4.3.2.1` 1624 1625 const networkPartiallyBridgedExpected = `auto lo 1626 iface lo inet loopback 1627 1628 iface eth0 inet manual 1629 1630 auto br-eth0 1631 iface br-eth0 inet static 1632 address 1.2.3.4 1633 netmask 255.255.255.0 1634 gateway 4.3.2.1 1635 bridge_ports eth0 1636 bridge_stp off 1637 bridge_maxwait 0 1638 1639 iface eth1 inet manual 1640 1641 auto br-eth1 1642 iface br-eth1 inet static 1643 address 1.2.3.5 1644 netmask 255.255.255.0 1645 gateway 4.3.2.1 1646 bridge_ports eth1 1647 bridge_stp off 1648 bridge_maxwait 0`