The steps that must be done after a device is configured
(self, address)
| 351 | self.delete(self.ip()) |
| 352 | |
| 353 | def post_configure(self, address): |
| 354 | """ The steps that must be done after a device is configured """ |
| 355 | route = CsRoute() |
| 356 | if not self.get_type() in ["control"]: |
| 357 | route.add_table(self.dev) |
| 358 | |
| 359 | CsRule(self.dev).addMark() |
| 360 | |
| 361 | interfaces = [CsInterface(address, self.config)] |
| 362 | CsHelper.reconfigure_interfaces(self.cl, interfaces) |
| 363 | if self.get_type() in ['public'] and not self.config.is_routed() and self.config.has_public_network(): |
| 364 | self.set_mark() |
| 365 | |
| 366 | if 'gateway' in self.address: |
| 367 | self.arpPing() |
| 368 | |
| 369 | CsRpsrfs(self.dev).enable() |
| 370 | self.post_config_change("add") |
| 371 | |
| 372 | '''For isolated/redundant and dhcpsrvr routers, call this method after the post_config is complete ''' |
| 373 | if self.get_type() in ["control"]: |
| 374 | self.setup_router_control() |
| 375 | |
| 376 | if self.config.is_vpc() or self.cl.is_redundant(): |
| 377 | # The code looks redundant here, but we actually have to cater for routers and |
| 378 | # VPC routers in a different manner. Please do not remove this block otherwise |
| 379 | # The VPC default route will be broken. |
| 380 | if not self.config.has_public_network(): |
| 381 | interface = self.config.address().get_guest_if_by_network_id() |
| 382 | if interface: |
| 383 | gateway = interface.get_gateway() |
| 384 | route.add_or_change_defaultroute(gateway) |
| 385 | CsDevice(self.dev, self.config).configure_rp(False) |
| 386 | elif self.get_type() in ["public"] and address["device"] == CsHelper.PUBLIC_INTERFACES[self.cl.get_type()]: |
| 387 | gateway = str(address["gateway"]) |
| 388 | route.add_defaultroute(gateway) |
| 389 | else: |
| 390 | # once we start processing public ip's we need to verify there |
| 391 | # is a default route and add if needed |
| 392 | if self.cl.get_gateway(): |
| 393 | route.add_defaultroute(self.cl.get_gateway()) |
| 394 | |
| 395 | if self.config.is_router() and self.cl.get_ip6gateway(): |
| 396 | route.add_defaultroute_v6(self.cl.get_ip6gateway()) |
| 397 | |
| 398 | def set_mark(self): |
| 399 | cmd = "-A PREROUTING -i %s -m state --state NEW -j CONNMARK --set-xmark %s/0xffffffff" % \ |
no test coverage detected