コード例 #1
0
 def _create_service_target(self, context, part_context, targets, group,
                            relationship):
     instance = part_context.instance
     node = part_context.current_node
     gbp_plugin = part_context.gbp_plugin
     for target in targets:
         if not group:
             exceptions.NotAvailablePTGForTargetRequest(
                 ptg_type=relationship, instance=instance['id'],
                 node=node['id'])
         data = {'policy_target_group_id': group['id'],
                 'description': TARGET_DESCRIPTION % (relationship,
                                                      node['id'],
                                                      instance['id']),
                 'name': '', 'port_id': None}
         data.update(target)
         pt = gbp_plugin.create_policy_target(context.elevated(),
                                              {'policy_target': data},
                                              notify_sc=False)
         model.set_service_target(part_context, pt['id'], relationship)
コード例 #2
0
 def _create_service_target(self, context, part_context, targets, group,
                            relationship):
     instance = part_context.instance
     node = part_context.current_node
     gbp_plugin = part_context.gbp_plugin
     for target in targets:
         if not group:
             exceptions.NotAvailablePTGForTargetRequest(
                 ptg_type=relationship, instance=instance['id'],
                 node=node['id'])
         data = {'policy_target_group_id': group['id'],
                 'description': TARGET_DESCRIPTION % (relationship,
                                                      node['id'],
                                                      instance['id']),
                 'name': '', 'port_id': None}
         data.update(target)
         pt = gbp_plugin.create_policy_target(context,
                                              {'policy_target': data},
                                              notify_sc=False)
         model.set_service_target(part_context, pt['id'], relationship)
コード例 #3
0
 def _create_service_target(self, context, part_context, targets, group,
                            relationship, extra_data=None):
     extra_data = extra_data or {}
     instance = part_context.instance
     node = part_context.current_node
     gbp_plugin = part_context.gbp_plugin
     for target in targets:
         if not group:
             raise exceptions.NotAvailablePTGForTargetRequest(
                 ptg_type=relationship, instance=instance['id'],
                 node=node['id'])
         data = {'policy_target_group_id': group['id'],
                 'description': TARGET_DESCRIPTION % (relationship,
                                                      node['id'],
                                                      instance['id']),
                 'name': SERVICE_TARGET_NAME_PREFIX + '%s_%s_%s' % (
                     relationship, node['id'][:5], instance['id'][:5]),
                 'port_id': None}
         data.update(extra_data)
         data.update(target)
         pt = gbp_plugin.create_policy_target(context.elevated(),
                                              {'policy_target': data})
         model.set_service_target(part_context, pt['id'], relationship)
コード例 #4
0
 def _create_service_target(self, context, part_context, targets, group,
                            relationship, extra_data=None):
     extra_data = extra_data or {}
     instance = part_context.instance
     node = part_context.current_node
     gbp_plugin = part_context.gbp_plugin
     for target in targets:
         if not group:
             raise exceptions.NotAvailablePTGForTargetRequest(
                 ptg_type=relationship, instance=instance['id'],
                 node=node['id'])
         data = {'policy_target_group_id': group['id'],
                 'description': TARGET_DESCRIPTION % (relationship,
                                                      node['id'],
                                                      instance['id']),
                 'name': SERVICE_TARGET_NAME_PREFIX + '%s_%s_%s' % (
                     relationship, node['id'][:5], instance['id'][:5]),
                 'port_id': None,
                 'cluster_id': ''}
         data.update(extra_data)
         data.update(target)
         pt = gbp_plugin.create_policy_target(context.elevated(),
                                              {'policy_target': data})
         model.set_service_target(part_context, pt['id'], relationship)