| 334 | return self.address |
| 335 | |
| 336 | def configure(self, address): |
| 337 | # When "add" is false, it means that the IP has to be removed. |
| 338 | if address["add"]: |
| 339 | try: |
| 340 | logging.info("Configuring address %s on device %s", self.ip(), self.dev) |
| 341 | cmd = "ip addr add dev %s %s brd +" % (self.dev, self.ip()) |
| 342 | CsHelper.execute(cmd) |
| 343 | cmd = "ifconfig %s mtu %s" % (self.dev, self.mtu()) |
| 344 | CsHelper.execute(cmd) |
| 345 | except Exception as e: |
| 346 | logging.info("Exception occurred ==> %s" % e) |
| 347 | |
| 348 | self.post_configure(address) |
| 349 | else: |
| 350 | # delete method performs post_configure, so no need to call post_configure here |
| 351 | self.delete(self.ip()) |
| 352 | |
| 353 | def post_configure(self, address): |
| 354 | """ The steps that must be done after a device is configured """ |