コード例 #1
0
    def setUp(self):
        #a new Placement Executive in another process for each test
        self.plex_proc = Process(target=PlacementExecutive)
        self.plex_proc.daemon = True

        if 'broker_man_host' in os.environ:
            self.man_host = os.environ['broker_man_host']
        else:
            self.man_host = 'http://localhost:15672'

        if 'sm_broker_host' in os.environ:
            self.sm_host = os.environ['sm_broker_host']
        else:
            self.sm_host = 'http://localhost:15672'
        url_user = "******".format(self.man_host)
        url_create = '{0}/api/vhosts/ssm-1234'.format(self.man_host)
        url_permission = '{0}/api/permissions/ssm-1234/specific-management'.format(
            self.man_host)
        self.headers = {'content-type': 'application/json'}
        data1 = '{"password":"******","tags":"son-sm"}'
        data2 = '{"configure":".*","write":".*","read":".*"}'
        res = requests.put(url=url_user,
                           headers=self.headers,
                           data=data1,
                           auth=('guest', 'guest'))
        LOG.info(res.content)
        res1 = requests.put(url=url_create,
                            headers=self.headers,
                            auth=('guest', 'guest'))
        LOG.info(res1.content)
        res2 = requests.put(url=url_permission,
                            headers=self.headers,
                            data=data2,
                            auth=('guest', 'guest'))
        LOG.info(res2.content)

        #make a new connection with the broker before each test
        url = "{0}/ssm-1234".format(self.sm_host)
        self.manoconn = ManoBrokerRequestResponseConnection(
            'son-plugin.SonPluginManager')
        self.sm_connection = ManoBrokerRequestResponseConnection(
            'son-plugin.SSM', url=url)

        #Some threading events that can be used during the tests
        self.wait_for_event1 = threading.Event()
        self.wait_for_event1.clear()

        self.wait_for_event2 = threading.Event()
        self.wait_for_event2.clear()
コード例 #2
0
def connection():
    """
    A loopback broker connection
    """
    connection = ManoBrokerRequestResponseConnection(
        "test-connection", is_loopback=True
    )
    yield connection
    connection.close()
コード例 #3
0
ファイル: terminating.py プロジェクト: CN-UPB/Pishahang
    def __init__(self):

        self.name = "fake-slm"
        self.version = "0.1-dev"
        self.description = "description"

        LOG.info("Starting SLM1:...")

        self.manoconn = ManoBrokerRequestResponseConnection(self.name)

        self.publish_terminating()
コード例 #4
0
ファイル: onboarding.py プロジェクト: CN-UPB/Pishahang
    def __init__(self):

        self.name = "fake-slm"
        self.version = "0.1-dev"
        self.description = "description"

        LOG.info("Starting SLM1:...")

        # create and initialize broker connection
        self.manoconn = ManoBrokerRequestResponseConnection(self.name)

        self.publish_nsd()
コード例 #5
0
    def setUpClass(cls):

        cls.smr_proc = Process(target=SpecificManagerRegistry)

        cls.smr_proc.daemon = True

        cls.manoconn = ManoBrokerRequestResponseConnection(
            "son-plugin.SpecificManagerRegistry")

        cls.wait_for_ssm_event = threading.Event()
        cls.wait_for_ssm_event.clear()

        cls.wait_for_fsm_event = threading.Event()
        cls.wait_for_fsm_event.clear()

        cls.event1 = False
        cls.event2 = False

        cls.smr_proc.start()
        time.sleep(4)
コード例 #6
0
 def setUp(self):
     # initialize messaging subsystem
     self.m = ManoBrokerRequestResponseConnection("pm-client" + self.id())
     self.wait_for_reply = Event()
     self.plugin_uuid = None