Ejemplo n.º 1
0
    def __init__(self, ctxt):
        Component.__init__(self, ctxt)
        self.ctypes = PyDatatypes(ctxt)
        self.SWITCH = None
        self.LOCATION = None
        self.HOST = None
        self.HOST_NETID = None
        self.USER = None
        self.ADDRESS = None
        self.GROUP = None
        self.GROUP_MEMBER = None

        self.MAC = None
        self.IPV4_CIDR = None
        self.IPV6 = None
        self.ALIAS = None
    def __init__(self, ctxt):
        Component.__init__(self, ctxt)
        self.ctypes = PyDatatypes(ctxt)
        self.SWITCH = None
        self.LOCATION = None
        self.HOST = None
        self.HOST_NETID = None
        self.USER = None
        self.ADDRESS = None
        self.GROUP = None
        self.GROUP_MEMBER = None

        self.MAC = None
        self.IPV4_CIDR = None
        self.IPV6 = None
        self.ALIAS = None
class Datatypes(Component):

    # Static types for *Info objects, not to be used by other
    # components

    _SWITCH       = -1
    _LOCATION     = -1
    _HOST         = -1
    _HOST_NETID   = -1
    _USER         = -1
    _ADDRESS      = -1
    _GROUP        = -1
    _GROUP_MEMBER = -1

    _MAC          = -1
    _IPV4_CIDR    = -1
    _IPV6         = -1
    _ALIAS        = -1

    def __init__(self, ctxt):
        Component.__init__(self, ctxt)
        self.ctypes = PyDatatypes(ctxt)
        self.SWITCH = None
        self.LOCATION = None
        self.HOST = None
        self.HOST_NETID = None
        self.USER = None
        self.ADDRESS = None
        self.GROUP = None
        self.GROUP_MEMBER = None

        self.MAC = None
        self.IPV4_CIDR = None
        self.IPV6 = None
        self.ALIAS = None

    def getInterface(self):
        return str(Datatypes)

    def configure(self, config):
        self.ctypes.configure(config)

    def install(self):
        self.SWITCH = Datatypes._SWITCH = self.ctypes.switch_type()
        self.LOCATION = Datatypes._LOCATION = self.ctypes.location_type()
        self.HOST = Datatypes._HOST = self.ctypes.host_type()
        self.HOST_NETID = Datatypes._HOST_NETID = self.ctypes.host_netid_type()
        self.USER = Datatypes._USER = self.ctypes.user_type()
        self.ADDRESS = Datatypes._ADDRESS = self.ctypes.address_type()
        self.GROUP = Datatypes._GROUP = self.ctypes.group_type()
        self.GROUP_MEMBER = Datatypes._GROUP_MEMBER \
            = self.ctypes.group_member_type()

        self.MAC = Datatypes._MAC = self.ctypes.mac_type()
        self.IPV4_CIDR = Datatypes._IPV4_CIDR = self.ctypes.ipv4_cidr_type()
        self.IPV6 = Datatypes._IPV6 = self.ctypes.ipv6_type()
        self.ALIAS = Datatypes._ALIAS = self.ctypes.alias_type()

    def datasource_type(self, name):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        return self.ctypes.datasource_type(name)

    def external_type(self, ds_t, name):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        return self.ctypes.external_type(ds_t, name)

    def attribute_type(self, ds_t, name):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        return self.ctypes.attribute_type(ds_t, name)

    def principal_table_name(self, val):
        return self.ctypes.principal_table_name(val)

    def principal_string(self, val):
        return self.ctypes.principal_string(val)

    def address_string(self, val):
        return self.ctypes.address_string(val)

    def datasource_string(self, val):
        return self.ctypes.datasource_string(val)

    def external_string(self, val):
        return self.ctypes.external_string(val)

    def attribute_string(self, val):
        return self.ctypes.attribute_string(val)

    def set_switch_type(self, val):
        self.ctypes.set_switch_type(val)
        self.SWITCH = Datatypes._SWITCH = val

    def set_location_type(self, val):
        self.ctypes.set_location_type(val)
        self.LOCATION = Datatypes._LOCATION = val

    def set_host_type(self, val):
        self.ctypes.set_host_type(val)
        self.HOST = Datatypes._HOST = val

    def set_host_netid_type(self, val):
        self.ctypes.set_host_netid_type(val)
        self.HOST_NETID = Datatypes._HOST_NETID = val

    def set_user_type(self, val):
        self.ctypes.set_user_type(val)
        self.USER = Datatypes._USER = val

    def set_address_type(self, val):
        self.ctypes.set_address_type(val)
        self.ADDRESS = Datatypes._ADDRESS = val

    def set_group_type(self, val):
        self.ctypes.set_group_type(val)
        self.GROUP = Datatypes._GROUP = val

    def set_group_member_type(self, val):
        self.ctypes.set_group_member_type(val)
        self.GROUP_MEMBER = Datatypes._GROUP_MEMBER = val

    def set_mac_type(self, val):
        self.ctypes.set_mac_type(val)
        self.MAC = Datatypes._MAC = val

    def set_ipv4_cidr_type(self, val):
        self.ctypes.set_ipv4_cidr_type(val)
        self.IPV4_CIDR = Datatypes._IPV4_CIDR = val

    def set_ipv6_type(self, val):
        self.ctypes.set_ipv6_type(val)
        self.IPV6 = Datatypes._IPV6 = val

    def set_alias_type(self, val):
        self.ctypes.set_alias_type(val)
        self.ALIAS = Datatypes._ALIAS = val

    def set_datasource_type(self, name, val):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        self.ctypes.set_datasource_type(name, val)

    def set_external_type(self, ds_t, name, val):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        self.ctypes.set_external_type(ds_t, name, val)

    def set_attribute_type(self, ds_t, name, val):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        self.ctypes.set_attribute_type(ds_t, name, val)

    def unset_principal_type(self, val):
        self.ctypes.unset_principal_type(val)

    def unset_address_type(self, val):
        self.ctypes.unset_address_type(val)

    def unset_datasource_type(self, val):
        self.ctypes.unset_datasource_type(val)

    def unset_external_type(self, val):
        self.ctypes.unset_external_type(val)

    def unset_attribute_type(self, val):
        self.ctypes.unset_attribute_type(val)
Ejemplo n.º 4
0
class Datatypes(Component):

    # Static types for *Info objects, not to be used by other
    # components

    _SWITCH = -1
    _LOCATION = -1
    _HOST = -1
    _HOST_NETID = -1
    _USER = -1
    _ADDRESS = -1
    _GROUP = -1
    _GROUP_MEMBER = -1

    _MAC = -1
    _IPV4_CIDR = -1
    _IPV6 = -1
    _ALIAS = -1

    def __init__(self, ctxt):
        Component.__init__(self, ctxt)
        self.ctypes = PyDatatypes(ctxt)
        self.SWITCH = None
        self.LOCATION = None
        self.HOST = None
        self.HOST_NETID = None
        self.USER = None
        self.ADDRESS = None
        self.GROUP = None
        self.GROUP_MEMBER = None

        self.MAC = None
        self.IPV4_CIDR = None
        self.IPV6 = None
        self.ALIAS = None

    def getInterface(self):
        return str(Datatypes)

    def configure(self, config):
        self.ctypes.configure(config)

    def install(self):
        self.SWITCH = Datatypes._SWITCH = self.ctypes.switch_type()
        self.LOCATION = Datatypes._LOCATION = self.ctypes.location_type()
        self.HOST = Datatypes._HOST = self.ctypes.host_type()
        self.HOST_NETID = Datatypes._HOST_NETID = self.ctypes.host_netid_type()
        self.USER = Datatypes._USER = self.ctypes.user_type()
        self.ADDRESS = Datatypes._ADDRESS = self.ctypes.address_type()
        self.GROUP = Datatypes._GROUP = self.ctypes.group_type()
        self.GROUP_MEMBER = Datatypes._GROUP_MEMBER \
            = self.ctypes.group_member_type()

        self.MAC = Datatypes._MAC = self.ctypes.mac_type()
        self.IPV4_CIDR = Datatypes._IPV4_CIDR = self.ctypes.ipv4_cidr_type()
        self.IPV6 = Datatypes._IPV6 = self.ctypes.ipv6_type()
        self.ALIAS = Datatypes._ALIAS = self.ctypes.alias_type()

    def datasource_type(self, name):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        return self.ctypes.datasource_type(name)

    def external_type(self, ds_t, name):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        return self.ctypes.external_type(ds_t, name)

    def attribute_type(self, ds_t, name):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        return self.ctypes.attribute_type(ds_t, name)

    def principal_table_name(self, val):
        return self.ctypes.principal_table_name(val)

    def principal_string(self, val):
        return self.ctypes.principal_string(val)

    def address_string(self, val):
        return self.ctypes.address_string(val)

    def datasource_string(self, val):
        return self.ctypes.datasource_string(val)

    def external_string(self, val):
        return self.ctypes.external_string(val)

    def attribute_string(self, val):
        return self.ctypes.attribute_string(val)

    def set_switch_type(self, val):
        self.ctypes.set_switch_type(val)
        self.SWITCH = Datatypes._SWITCH = val

    def set_location_type(self, val):
        self.ctypes.set_location_type(val)
        self.LOCATION = Datatypes._LOCATION = val

    def set_host_type(self, val):
        self.ctypes.set_host_type(val)
        self.HOST = Datatypes._HOST = val

    def set_host_netid_type(self, val):
        self.ctypes.set_host_netid_type(val)
        self.HOST_NETID = Datatypes._HOST_NETID = val

    def set_user_type(self, val):
        self.ctypes.set_user_type(val)
        self.USER = Datatypes._USER = val

    def set_address_type(self, val):
        self.ctypes.set_address_type(val)
        self.ADDRESS = Datatypes._ADDRESS = val

    def set_group_type(self, val):
        self.ctypes.set_group_type(val)
        self.GROUP = Datatypes._GROUP = val

    def set_group_member_type(self, val):
        self.ctypes.set_group_member_type(val)
        self.GROUP_MEMBER = Datatypes._GROUP_MEMBER = val

    def set_mac_type(self, val):
        self.ctypes.set_mac_type(val)
        self.MAC = Datatypes._MAC = val

    def set_ipv4_cidr_type(self, val):
        self.ctypes.set_ipv4_cidr_type(val)
        self.IPV4_CIDR = Datatypes._IPV4_CIDR = val

    def set_ipv6_type(self, val):
        self.ctypes.set_ipv6_type(val)
        self.IPV6 = Datatypes._IPV6 = val

    def set_alias_type(self, val):
        self.ctypes.set_alias_type(val)
        self.ALIAS = Datatypes._ALIAS = val

    def set_datasource_type(self, name, val):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        self.ctypes.set_datasource_type(name, val)

    def set_external_type(self, ds_t, name, val):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        self.ctypes.set_external_type(ds_t, name, val)

    def set_attribute_type(self, ds_t, name, val):
        if isinstance(name, unicode):
            name = name.encode('utf-8')
        self.ctypes.set_attribute_type(ds_t, name, val)

    def unset_principal_type(self, val):
        self.ctypes.unset_principal_type(val)

    def unset_address_type(self, val):
        self.ctypes.unset_address_type(val)

    def unset_datasource_type(self, val):
        self.ctypes.unset_datasource_type(val)

    def unset_external_type(self, val):
        self.ctypes.unset_external_type(val)

    def unset_attribute_type(self, val):
        self.ctypes.unset_attribute_type(val)