当前位置: 首页>>代码示例>>Java>>正文


Java ManagerSecurityGroupElement类代码示例

本文整理汇总了Java中org.osc.sdk.manager.element.ManagerSecurityGroupElement的典型用法代码示例。如果您正苦于以下问题:Java ManagerSecurityGroupElement类的具体用法?Java ManagerSecurityGroupElement怎么用?Java ManagerSecurityGroupElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ManagerSecurityGroupElement类属于org.osc.sdk.manager.element包,在下文中一共展示了ManagerSecurityGroupElement类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSecurityGroupById

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
@Override
public ManagerSecurityGroupElement getSecurityGroupById(String mgrSecurityGroupId) throws Exception {
    if (mgrSecurityGroupId == null) {
        return null;
    }
    DeviceEntity device = this.validationUtil.getDeviceOrThrow(this.vs.getMgrId());

    return this.txControl.supports(() -> {
        CriteriaBuilder cb = IsmSecurityGroupApi.this.em.getCriteriaBuilder();
        CriteriaQuery<SecurityGroupEntity> query = cb.createQuery(SecurityGroupEntity.class);
        Root<SecurityGroupEntity> root = query.from(SecurityGroupEntity.class);

        query.select(root).where(cb.equal(root.get("id"), Long.valueOf(mgrSecurityGroupId)),
                cb.equal(root.get("device"), device));

        SecurityGroupEntity result = null;
        try {
            result = IsmSecurityGroupApi.this.em.createQuery(query).getSingleResult();
        } catch (NoResultException e) {
            LOG.error(String.format("Cannot find Security group with id %s under device %s", mgrSecurityGroupId,
                    device.getId()));
        }
        return result;
    });
}
 
开发者ID:opensecuritycontroller,项目名称:security-mgr-sample-plugin,代码行数:26,代码来源:IsmSecurityGroupApi.java

示例2: getSecurityGroupIds

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
@GET
public List<String> getSecurityGroupIds(@PathParam("deviceId") Long deviceId) throws Exception {
    LOG.info("Listing security group ids'");

    this.validationUtil.getDeviceOrThrow(Long.toString(deviceId));

    VirtualSystemElementImpl vs = new VirtualSystemElementImpl(deviceId, null);
    this.sgApi = new IsmSecurityGroupApi(vs, this.txControl, this.em);

    return this.sgApi.getSecurityGroupList().stream().map(ManagerSecurityGroupElement::getSGId)
            .collect(Collectors.toList());
}
 
开发者ID:opensecuritycontroller,项目名称:security-mgr-sample-plugin,代码行数:13,代码来源:SecurityGroupApis.java

示例3: getSecurityGroupList

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
@Override
public List<? extends ManagerSecurityGroupElement> getSecurityGroupList() throws Exception {
    DeviceEntity device = this.validationUtil.getDeviceOrThrow(this.vs.getMgrId());

    return this.txControl.supports(() -> {
        CriteriaBuilder cb = IsmSecurityGroupApi.this.em.getCriteriaBuilder();
        CriteriaQuery<SecurityGroupEntity> query = cb.createQuery(SecurityGroupEntity.class);
        Root<SecurityGroupEntity> root = query.from(SecurityGroupEntity.class);

        query.select(root).where(cb.equal(root.get("device"), device));
        return IsmSecurityGroupApi.this.em.createQuery(query).getResultList();
    });
}
 
开发者ID:opensecuritycontroller,项目名称:security-mgr-sample-plugin,代码行数:14,代码来源:IsmSecurityGroupApi.java

示例4: findBySecurityGroupByName

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
private ManagerSecurityGroupElement findBySecurityGroupByName(
        List<? extends ManagerSecurityGroupElement> mgrSecurityGroups, String securityGroupName) {
    for (ManagerSecurityGroupElement mgrSecurityGroup : mgrSecurityGroups) {
        if (mgrSecurityGroup.getName().equals(securityGroupName)) {
            return mgrSecurityGroup;
        }
    }
    return null;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:10,代码来源:MgrSecurityGroupCheckMetaTask.java

示例5: findByMgrSecurityGroupId

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
private ManagerSecurityGroupElement findByMgrSecurityGroupId(
        List<? extends ManagerSecurityGroupElement> mgrSecurityGroups, String mgrSecurityGroupId) {
    for (ManagerSecurityGroupElement mgrSecurityGroup : mgrSecurityGroups) {
        if (mgrSecurityGroup.getSGId().equals(mgrSecurityGroupId)) {
            return mgrSecurityGroup;
        }
    }
    return null;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:10,代码来源:MgrSecurityGroupCheckMetaTask.java

示例6: create

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
public DeleteMgrSecurityGroupTask create(VirtualSystem vs, ManagerSecurityGroupElement msge) {
    DeleteMgrSecurityGroupTask task = new DeleteMgrSecurityGroupTask();
    task.vs = vs;
    task.msge = msge;
    task.name = task.getName();
    task.apiFactoryService = this.apiFactoryService;
    task.dbConnectionManager = this.dbConnectionManager;
    task.txBroadcastUtil = this.txBroadcastUtil;

    return task;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:12,代码来源:DeleteMgrSecurityGroupTask.java

示例7: createMgrSecurityGroupElement

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
private static  ManagerSecurityGroupElement createMgrSecurityGroupElement() {
    ManagerSecurityGroupElement mgrSecGroupElement = Mockito.mock(ManagerSecurityGroupElement.class);
    Mockito.when(mgrSecGroupElement.getSGId()).thenReturn(UUID.randomUUID().toString());
    Mockito.when(mgrSecGroupElement.getName()).thenReturn(UUID.randomUUID().toString());

    return mgrSecGroupElement;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:8,代码来源:MgrSecurityGroupCheckMetaTaskTestData.java

示例8: buildTaskGraph

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
private void buildTaskGraph(EntityManager em, boolean isDeleteTg, String domainId) throws Exception {
      VmDiscoveryCache vdc = new VmDiscoveryCache(this.sg.getVirtualizationConnector(),
              this.sg.getVirtualizationConnector().getProviderAdminProjectName());

if (this.apiFactoryService.supportsNeutronSFC(this.sg.getVirtualizationConnector().getControllerType())) {

	// if SFC binded and network element null -> create PC
	// if SFC binded and network element not null -> update PC
	// if SFC not binded and network element not null -> delete PC

	if (this.sg.getServiceFunctionChain() != null
			|| (this.sg.getServiceFunctionChain() == null && this.sg.getNetworkElementId() != null)) {
		this.tg.appendTask(this.checkServiceFunctionChainMetaTask.create(this.sg),
				TaskGuard.ALL_PREDECESSORS_SUCCEEDED);
	}

}

      // SGM Member sync with no task deferred
      addSGMemberSyncJob(em, isDeleteTg, vdc);

      if (this.sg.getVirtualizationConnector().isControllerDefined()
              && this.apiFactoryService.supportsPortGroup(this.sg)) {
          this.tg.appendTask(this.portGroupCheckMetaTask.create(this.sg, isDeleteTg, domainId),
                  TaskGuard.ALL_PREDECESSORS_COMPLETED);
      }

      for (SecurityGroupInterface sgi : this.sg.getSecurityGroupInterfaces()) {
          List<Task> tasksToSucceedToDeleteSGI = new ArrayList<>();
          if (this.apiFactoryService.supportsPortGroup(this.sg)) {
              CheckPortGroupHookMetaTask checkPortGroupMT = this.checkPortGroupHookMetaTask.create(sgi, isDeleteTg);
              this.tg.appendTask(checkPortGroupMT);
              tasksToSucceedToDeleteSGI.add(checkPortGroupMT);
          }

          if (sgi.getMarkedForDeletion() || isDeleteTg) {
              VirtualSystem vs = sgi.getVirtualSystem();
              if (this.apiFactoryService.syncsSecurityGroup(vs)) {
                  try (ManagerSecurityGroupApi mgrSgApi = this.apiFactoryService.createManagerSecurityGroupApi(vs)) {
                      ManagerSecurityGroupElement mepg = mgrSgApi.getSecurityGroupById(sgi.getMgrSecurityGroupId());
                      if (mepg != null) {
                          DeleteMgrSecurityGroupTask mgrSecurityGroupDelTask = this.deleteMgrSecurityGroupTask
                                  .create(vs, mepg);
                          this.tg.appendTask(mgrSecurityGroupDelTask);
                          tasksToSucceedToDeleteSGI.add(mgrSecurityGroupDelTask);
                      }
                  }
              }

              // Mostly applies only when SGI marked for deletion(not delete tg case) In delete tg case, the members
              // are already deleted and this essentially a no op. The tasks SecurityGroupMemberVmCheckTask etc
              // need to make sure hooks are removed in case of delete tg.
              boolean shouldRemoveHooks = !this.apiFactoryService.supportsPortGroup(this.sg)
                      && !this.apiFactoryService.supportsNeutronSFC(this.sg);
              if (shouldRemoveHooks) {
                  tasksToSucceedToDeleteSGI.addAll(addSGMemberRemoveHooksTask(em, sgi));
              }

              // Ensure removal of mapping for all DAIs before removing SGI.
              this.tg.addTask(this.deleteSecurityGroupInterfaceTask.create(sgi), TaskGuard.ALL_PREDECESSORS_SUCCEEDED,
                      tasksToSucceedToDeleteSGI.toArray(new Task[0]));
          }
      }

      this.tg.appendTask(this.securityGroupMemberMapPropagateMetaTask.create(this.sg),
              TaskGuard.ALL_PREDECESSORS_COMPLETED);

      if (isDeleteTg) {
          this.tg.appendTask(this.deleteSecurityGroupFromDbTask.create(this.sg), TaskGuard.ALL_ANCESTORS_SUCCEEDED);
      }

  }
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:73,代码来源:SecurityGroupUpdateOrDeleteMetaTask.java

示例9: findVmidcSecurityGroupByMgrId

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
private SecurityGroup findVmidcSecurityGroupByMgrId(EntityManager em, ManagerSecurityGroupElement mgrSecurityGroup)
        throws Exception {
    return SecurityGroupEntityMgr.listSecurityGroupsByVcIdAndMgrId(em, this.vs.getVirtualizationConnector().getId(),
            mgrSecurityGroup.getSGId());
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:6,代码来源:MgrSecurityGroupCheckMetaTask.java

示例10: registerMgrSecurityGroup

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
private void registerMgrSecurityGroup(SecurityGroup sg, VirtualSystem vs, ManagerSecurityGroupElement mgrSecGroupElement) throws Exception {
    Mockito.when(this.mgrSgApi.getSecurityGroupById(sg.getSecurityGroupInterfaces().iterator().next().getMgrSecurityGroupId())).thenReturn(mgrSecGroupElement);
    Mockito.when(this.apiFactoryServiceMock.createManagerSecurityGroupApi(vs)).thenReturn(this.mgrSgApi);
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:5,代码来源:MgrSecurityGroupCheckMetaTaskTest.java

示例11: deleteMgrSecGroupGraph

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
public static TaskGraph deleteMgrSecGroupGraph(VirtualSystem vs, ManagerSecurityGroupElement mgrSecGroupElement) {
    TaskGraph expectedGraph = new TaskGraph();

    expectedGraph.appendTask(new DeleteMgrSecurityGroupTask().create(vs, mgrSecGroupElement));

    return expectedGraph;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:8,代码来源:MgrSecurityGroupCheckMetaTaskTestData.java

示例12: getSecurityGroupList

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
/**
 * Retrieves all the security groups from the security manager.
 *
 * @return the collection of all the security groups present in the security manager
 * @throws Exception upon failure
 */
List<? extends ManagerSecurityGroupElement> getSecurityGroupList() throws Exception;
 
开发者ID:opensecuritycontroller,项目名称:security-mgr-api,代码行数:8,代码来源:ManagerSecurityGroupApi.java

示例13: getSecurityGroupById

import org.osc.sdk.manager.element.ManagerSecurityGroupElement; //导入依赖的package包/类
/**
 * Retrieves the security group given its identifier.
 * @param mgrSecurityGroupId the identifier of the manager security group
 * @return the security group
 * @throws Exception upon failure
 */
ManagerSecurityGroupElement getSecurityGroupById(String mgrSecurityGroupId) throws Exception;
 
开发者ID:opensecuritycontroller,项目名称:security-mgr-api,代码行数:8,代码来源:ManagerSecurityGroupApi.java


注:本文中的org.osc.sdk.manager.element.ManagerSecurityGroupElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。