ONOS-3759 Group default provider

Change-Id: I318c8036a1836d13f57187bfd28464c740e09f08
diff --git a/core/net/src/main/java/org/onosproject/net/group/impl/GroupDriverProvider.java b/core/net/src/main/java/org/onosproject/net/group/impl/GroupDriverProvider.java
new file mode 100644
index 0000000..75fbb89
--- /dev/null
+++ b/core/net/src/main/java/org/onosproject/net/group/impl/GroupDriverProvider.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.group.impl;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.group.GroupOperations;
+import org.onosproject.net.group.GroupProgrammable;
+import org.onosproject.net.group.GroupProvider;
+import org.onosproject.net.provider.AbstractProvider;
+import org.onosproject.net.provider.ProviderId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Driver-based Group rule provider.
+ */
+public class GroupDriverProvider extends AbstractProvider implements GroupProvider {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    // To be extracted for reuse as we deal with other.
+    private static final String SCHEME = "default";
+    private static final String PROVIDER_NAME = "org.onosproject.provider";
+    protected DeviceService deviceService;
+
+    public GroupDriverProvider() {
+        super(new ProviderId(SCHEME, PROVIDER_NAME));
+    }
+
+    /**
+     * Initializes the provider with the necessary device service.
+     *
+     * @param deviceService device service
+     */
+    void init(DeviceService deviceService) {
+        this.deviceService = deviceService;
+    }
+
+    @Override
+    public void performGroupOperation(DeviceId deviceId, GroupOperations groupOps) {
+        GroupProgrammable programmable = getGroupProgrammable(deviceId);
+        if (programmable != null) {
+            programmable.performGroupOperation(deviceId, groupOps);
+        }
+    }
+
+    private GroupProgrammable getGroupProgrammable(DeviceId deviceId) {
+        GroupProgrammable programmable = deviceService.getDevice(deviceId).as(GroupProgrammable.class);
+        if (programmable == null) {
+            log.warn("Device {} is not group programmable");
+        }
+        return programmable;
+    }
+}