From af110352f8f61f68c4758f2c8c0846f9691e6bf1 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Mon, 9 Jun 2014 16:38:34 -0400 Subject: Initial ifcfg implementation for interfaces/routes Ifcfg formatted persistence for interfaces and routes. --- os_net_config/objects.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'os_net_config/objects.py') diff --git a/os_net_config/objects.py b/os_net_config/objects.py index 8c1fcd5..455e55f 100644 --- a/os_net_config/objects.py +++ b/os_net_config/objects.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # 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 @@ -20,9 +22,10 @@ class NetworkObjectException(Exception): class Route(object): """Base class for network routes.""" - def __init__(self, netmask_cidr, gateway): - self.netmask_cidr = netmask_cidr - self.gateway = gateway + def __init__(self, next_hop, ip_netmask="", default=False): + self.next_hop = next_hop + self.ip_netmask = ip_netmask + self.default = default class Address(object): @@ -41,10 +44,11 @@ class Interface(object): """Base class for network interfaces.""" def __init__(self, name, use_dhcp=False, use_dhcpv6=False, addresses=[], - mtu=1500): + routes=[], mtu=1500): self.name = name self.mtu = mtu self.use_dhcp = use_dhcp + self.use_dhcpv6 = use_dhcpv6 self.addresses = addresses self.bridge = None self.type = None -- cgit 1.2.3-korg