Exemplo n.º 1
0
    def _add_device_to_device_group(self, device):
        '''Add device to device service cluster group.

        :param device: bigip object -- device to add to group
        '''

        device_name = get_device_info(device).name
        dg = pollster(self._get_device_group)(device)
        dg.devices_s.devices.create(name=device_name, partition=self.partition)
        pollster(self._check_device_exists_in_device_group)(device_name)
Exemplo n.º 2
0
    def create(self, **kwargs):
        '''Create the device service cluster group and add devices to it.'''

        self._set_attributes(**kwargs)
        self._check_type()
        pollster(self._check_all_devices_in_sync)()
        dg = self.devices[0].tm.cm.device_groups.device_group
        dg.create(name=self.name, partition=self.partition, type=self.type)
        for device in self.devices:
            self._add_device_to_device_group(device)
            device.tm.sys.config.exec_cmd('save')
        self.ensure_all_devices_in_sync()
Exemplo n.º 3
0
    def create(self, **kwargs):
        '''Add trusted peers to the root bigip device.

        When adding a trusted device to a device, the trust is reflexive. That
        is, the truster trusts the trustee and the trustee trusts the truster.
        So we only need to add the trusted devices to one device.

        :param kwargs: dict -- devices and partition
        '''

        self._set_attributes(**kwargs)
        for device in self.devices[1:]:
            self._add_trustee(device)
        pollster(self.validate)()
Exemplo n.º 4
0
    def _deploy_iapp(self, iapp_name, actions, deploying_device):
        '''Deploy iapp to add trusted device

        :param iapp_name: str -- name of iapp
        :param actions: dict -- actions definition of iapp sections
        :param deploying_device: ManagementRoot object -- device where the
                                 iapp will be created
        '''

        tmpl = deploying_device.tm.sys.application.templates.template
        serv = deploying_device.tm.sys.application.services.service
        tmpl.create(name=iapp_name, partition=self.partition, actions=actions)
        pollster(deploying_device.tm.sys.application.templates.template.load)(
            name=iapp_name, partition=self.partition)
        serv.create(name=iapp_name,
                    partition=self.partition,
                    template='/%s/%s' % (self.partition, iapp_name))
Exemplo n.º 5
0
    def _delete_device_from_device_group(self, device):
        '''Remove device from device service cluster group.

        :param device: ManagementRoot object -- device to delete from group
        '''

        device_name = get_device_info(device).name
        dg = pollster(self._get_device_group)(device)
        device_to_remove = dg.devices_s.devices.load(
            name=device_name, partition=self.partition
        )
        device_to_remove.delete()
Exemplo n.º 6
0
    def _get_device_names_in_group(self):
        '''_get_device_names_in_group

        :returns: list -- list of device names in group
        '''

        device_names = []
        dg = pollster(self._get_device_group)(self.devices[0])
        members = dg.devices_s.get_collection()
        for member in members:
            member_name = member.name.replace('/%s/' % self.partition, '')
            device_names.append(member_name)
        return device_names
Exemplo n.º 7
0
    def _get_add_trustee_cmd(self, trustee):
        '''Get tmsh command to add a trusted device.

        :param trustee: ManagementRoot object -- device to add as trusted
        :returns: str -- tmsh command to add trustee
        '''

        trustee_info = pollster(get_device_info)(trustee)
        username = trustee._meta_data['username']
        password = trustee._meta_data['password']
        return 'tmsh::modify cm trust-domain Root ca-devices add ' \
            '\\{ %s \\} name %s username %s password %s' % \
            (trustee_info.managementIp, trustee_info.name, username, password)
Exemplo n.º 8
0
    def teardown(self):
        '''Teardown device service cluster group.'''

        self.ensure_all_devices_in_sync()
        for device in self.devices:
            self._delete_device_from_device_group(device)
            self._sync_to_group(device)
            pollster(self._ensure_device_active)(device)
            self.ensure_all_devices_in_sync()
        dg = pollster(self._get_device_group)(self.devices[0])
        dg.delete()
        pollster(self._check_devices_active_licensed)()
        pollster(self._check_all_devices_in_sync)()
Exemplo n.º 9
0
    def ensure_all_devices_in_sync(self):
        """Ensure all devices have 'In Sync' status are sync is done."""

        self._sync_to_group(self.devices[0])
        pollster(self._check_all_devices_in_sync)()