X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=applications%2Fforwardingrules-sync%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fapplications%2Ffrsync%2Futil%2FPathUtil.java;fp=applications%2Fforwardingrules-sync%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fapplications%2Ffrsync%2Futil%2FPathUtil.java;h=f4a91c237b8c2961d4d0acc4e724fe158c254e76;hb=ac62e7225be9a7c56edf3dfc1ee41dee6ac31b54;hp=0000000000000000000000000000000000000000;hpb=9e6b422cff65b2ad3508e06b3ac0b345434f4a4a;p=openflowplugin.git diff --git a/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/util/PathUtil.java b/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/util/PathUtil.java new file mode 100644 index 0000000000..f4a91c237b --- /dev/null +++ b/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/util/PathUtil.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.openflowplugin.applications.frsync.util; + +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; +import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +/** + * Basic {@link InstanceIdentifier} related tools. + */ +public class PathUtil { + public static NodeId digNodeId(final InstanceIdentifier nodeIdent) { + return nodeIdent.firstKeyOf(Node.class, NodeKey.class).getId(); + } + + public static InstanceIdentifier digNodePath(final InstanceIdentifier nodeIdent) { + return nodeIdent.firstIdentifierOf(Node.class); + } +}