Newer
Older
import ipaddress
from pydantic import BaseSettings
class V6ServiceNetwork(BaseSettings):
class ServiceNetworks(BaseSettings):
v4: V4ServiceNetwork
v6: V6ServiceNetwork
class V4HostAddress(BaseSettings):
class V6HostAddress(BaseSettings):
v6: ipaddress.IPv6Address
class HostAddresses(BaseSettings):
v4: V4HostAddress
v6: V6HostAddress
def new_service_networks(service_type) -> ServiceNetworks:
v4_service_network = _ipam.allocate_service_ipv4_network(service_type=service_type)
v6_service_network = _ipam.allocate_service_ipv6_network(service_type=service_type)
v4=v4_service_network,
v6=v6_service_network)
def new_service_host(hostname, service_type) -> HostAddresses:
return _ipam.allocate_service_host(hostname=hostname, service_type=service_type)
new_service_networks('TRUNK')
#new_service_host('newhost12', 'TRUNK')