2 * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.nemo.user.vnspacemanager.instancecheck;
\r
10 import org.opendaylight.nemo.user.tenantmanager.TenantManage;
\r
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.common.rev151010.UserId;
\r
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.objects.Flow;
\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.users.User;
\r
15 import java.util.List;
\r
18 * Created by z00293636 on 2015/9/10.
\r
20 public class FlowInstanceCheck {
\r
21 private TenantManage tenantManage;
\r
23 public FlowInstanceCheck(TenantManage tenantManage)
\r
25 this.tenantManage = tenantManage;
\r
28 public String checkFlowInstance(UserId userId, Flow flow)
\r
30 String errorInfo = null;
\r
32 tenantManage.fetchVNSpace(userId);
\r
35 User user = tenantManage.getUser();
\r
38 if (user.getObjects() != null)
\r
40 if (user.getObjects().getFlow() != null)
\r
42 List<Flow> flowList = tenantManage.getUser().getObjects().getFlow();
\r
43 for (Flow flow1 : flowList)
\r
45 if (flow1.getFlowId() == flow.getFlowId())
\r
47 if (flow1.getFlowName() != flow.getFlowName())
\r
49 errorInfo = "The flow name should not be changed.";
\r