예제 #1
0
    def load_db(self, args, sync_database):
        self.session.set_login_credentials(args)
        # fabric = Fabric.get_deep(self.session.session)[0]
        # fabric.populate_children(deep=True, include_concrete=True)

        fabric = None
        if not self.initialized:
            if not APIC:
                fabric = Fabric.get_deep(self.session.session,
                                         include_concrete=True)[0]
                self.index.add_atk_objects(fabric)
                self.store.add_atk_objects(fabric)
                self.initialized = True
            else:
                self.index.session = self.session.session
                self.store.session = self.session.session
        print("done loading initial database")
        if sync_database is True:
            print("in updating")
            self.update_db_thread = Update_db_on_event(self)
            self.update_db_thread.subscribed_classes = []
            self.update_db_thread.session = self.session.session
            self.update_db_thread.index = self.index
            self.update_db_thread.store = self.store
            self.update_db_thread.subscribed_classes = fabric.update_db(
                self.session.session, self.update_db_thread.subscribed_classes,
                True)
            self.update_db_thread.daemon = True
            self.update_db_thread.start()
예제 #2
0
    def load_db(self, args, sync_database):
        self.session.set_login_credentials(args)
        # fabric = Fabric.get_deep(self.session.session)[0]
        # fabric.populate_children(deep=True, include_concrete=True)

        fabric = None
        if not self.initialized:
            if not APIC:
                fabric = Fabric.get_deep(self.session.session, include_concrete=True)[0]
                self.index.add_atk_objects(fabric)
                self.store.add_atk_objects(fabric)
                self.initialized = True
            else:
                self.index.session = self.session.session
                self.store.session = self.session.session
        print "done loading initial database"
        if sync_database is True:
            print "in updating"
            self.update_db_thread = Update_db_on_event(self)
            self.update_db_thread.subscribed_classes = []
            self.update_db_thread.session = self.session.session
            self.update_db_thread.index = self.index
            self.update_db_thread.store = self.store
            self.update_db_thread.subscribed_classes = fabric.update_db(self.session.session, self.update_db_thread.subscribed_classes, True)
            self.update_db_thread.daemon = True
            self.update_db_thread.start()
예제 #3
0
    def load_db(self, args):
        self.session.set_login_credentials(args)
        # fabric = Fabric.get_deep(self.session.session)[0]
        # fabric.populate_children(deep=True, include_concrete=True)

        fabric = Fabric.get_deep(self.session.session, include_concrete=True)[0]
        self.index.add_atk_objects(fabric)
        self.store.add_atk_objects(fabric)
        self.initialized = True
예제 #4
0
    def load_db(self, args):
        self.session.set_login_credentials(args)
        # fabric = Fabric.get_deep(self.session.session)[0]
        # fabric.populate_children(deep=True, include_concrete=True)

        fabric = Fabric.get_deep(self.session.session,
                                 include_concrete=True)[0]
        self.index.add_atk_objects(fabric)
        self.store.add_atk_objects(fabric)
        self.initialized = True