Exemple #1
0
    def install(self):
        dm = self.resolve(directorymanager)

        self.register_handler(Host_event.static_get_name(), self.host_event)
        self.register_handler(Principal_name_event.static_get_name(),
                              self.principal_name_event)
        ws = self.resolve(str(webservice.webservice))
        v1 = ws.get_version("1")
        reg = v1.register_request

        #GET /ws.v1/host/<dir name>/<principal name>/last_seen
        path = ( webservice.WSPathStaticString("host"), ) + \
                         (WSPathExistingDirName(dm, "<dir name>"),) + \
                         (WSPathArbitraryString("<principal name>"),) + \
                         (webservice.WSPathStaticString("last_seen"),)

        reg(
            self._get_last_seen_str, "GET", path,
            """Get string indicated the last time this host was seen on the network."""
        )

        # we persistently store data in simple_config, so we don't
        # lose all data if nox is restarted
        self.simple_config = self.resolve(simple_config)
        d = self.simple_config.get_config("hosttrackerws")
        d.addCallback(self.load_from_config)  #initial load
        self.post_callback(PERIODIC_SAVE_INTERVAL, self.periodic_save)
Exemple #2
0
    def install(self):
        dm = self.resolve(directorymanager)

        self.register_handler(Host_event.static_get_name(), self.host_event)
        self.register_handler(Principal_name_event.static_get_name(), 
                              self.principal_name_event)
        ws  = self.resolve(str(webservice.webservice))
        v1  = ws.get_version("1")
        reg = v1.register_request

        #GET /ws.v1/host/<dir name>/<principal name>/last_seen
        path = ( webservice.WSPathStaticString("host"), ) + \
                         (WSPathExistingDirName(dm, "<dir name>"),) + \
                         (WSPathArbitraryString("<principal name>"),) + \
                         (webservice.WSPathStaticString("last_seen"),)

        reg(self._get_last_seen_str, "GET", path,
            """Get string indicated the last time this host was seen on the network.""")
    
        # we persistently store data in simple_config, so we don't 
        # lose all data if nox is restarted
        self.simple_config = self.resolve(simple_config)
        d = self.simple_config.get_config("hosttrackerws") 
        d.addCallback(self.load_from_config) #initial load
        self.post_callback(PERIODIC_SAVE_INTERVAL,self.periodic_save)
Exemple #3
0
 def _registered_with_dm(self, res):
     #Listen for name events to keep global groups up to date
     self.register_handler(Principal_name_event.static_get_name(),
             self.renamed_principal)
     self.register_handler(Group_name_event.static_get_name(),
             self.renamed_group)
     d = self._dm.add_configured_directory(SEPL_DIRECTORY_NAME,
             self.get_type(), 0, 0, ignore_if_dup_name=True)
     return d
    def install(self):

        self.dm = self.resolve(directorymanager)
        
        # temporarily need switchstats until port names
        # are stored in the directory
        self.switchstats = self.resolve(switchstats)

        self.register_for_datapath_join (self.dp_join)
        self.register_for_port_status(self.port_status)
       
        self.register_handler(Principal_name_event.static_get_name(),
                              self.handle_principal_name_event)
        # must listen for switch rename, delete

        self.simple_config = self.resolve(simple_config)
        d = self.simple_config.get_config("switch_nat_config",
                              self.handle_nat_config_update) 
        d.addCallback(self.handle_nat_config_update) #initial load
        return d
Exemple #5
0
    def install(self):

        self.dm = self.resolve(directorymanager)

        # temporarily need switchstats until port names
        # are stored in the directory
        self.switchstats = self.resolve(switchstats)

        self.register_for_datapath_join(self.dp_join)
        self.register_for_port_status(self.port_status)

        self.register_handler(Principal_name_event.static_get_name(),
                              self.handle_principal_name_event)
        # must listen for switch rename, delete

        self.simple_config = self.resolve(simple_config)
        d = self.simple_config.get_config("switch_nat_config",
                                          self.handle_nat_config_update)
        d.addCallback(self.handle_nat_config_update)  #initial load
        return d
Exemple #6
0
    def configure(self, configuration):
        self.init_policy = None
        arg_len = len(configuration['arguments'])
        if arg_len == 1:
            self.init_policy = configuration['arguments'][0]
        elif arg_len > 1:
            lg.error("Policy only accepts one param - the policy module name.")
            raise Exception('Policy only accepts one param - the policy module name.')
            
        self.authenticator = self.resolve(PyAuth)
        self.flow_util = self.resolve(PyFlowUtil)
        self.stats = self.resolve(PySeplStats)
        self.policystore = self.resolve(str(PolicyStore))
        self._dm = self.resolve(directorymanager)
        self.uel = self.resolve(pyuser_event_log)

        self.register_for_bootstrap_complete(self.bootstrapped)
        self.register_handler(Principal_name_event.static_get_name(),
                              self.__renamed_principal__)
        self.register_handler(Group_name_event.static_get_name(),
                              self.__renamed_group__)

        compile.__policy__ = self
Exemple #7
0
    def configure(self, configuration):
        self.init_policy = None
        arg_len = len(configuration['arguments'])
        if arg_len == 1:
            self.init_policy = configuration['arguments'][0]
        elif arg_len > 1:
            lg.error("Policy only accepts one param - the policy module name.")
            raise Exception(
                'Policy only accepts one param - the policy module name.')

        self.authenticator = self.resolve(PyAuth)
        self.flow_util = self.resolve(PyFlowUtil)
        self.stats = self.resolve(PySeplStats)
        self.policystore = self.resolve(str(PolicyStore))
        self._dm = self.resolve(directorymanager)
        self.uel = self.resolve(pyuser_event_log)

        self.register_for_bootstrap_complete(self.bootstrapped)
        self.register_handler(Principal_name_event.static_get_name(),
                              self.__renamed_principal__)
        self.register_handler(Group_name_event.static_get_name(),
                              self.__renamed_group__)

        compile.__policy__ = self