diff --git a/internal/core/adapter.go b/internal/core/adapter.go
new file mode 100644
index 0000000..a96767f
--- /dev/null
+++ b/internal/core/adapter.go
@@ -0,0 +1,54 @@
+/*
+* Copyright 2022-present Open Networking Foundation
+
+* 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 core
+
+import (
+	"context"
+	"fmt"
+
+	"github.com/golang/protobuf/ptypes/empty"
+	"github.com/opencord/voltha-lib-go/v7/pkg/log"
+	"github.com/opencord/voltha-northbound-bbf-adapter/internal/clients"
+)
+
+var AdapterInstance *VolthaYangAdapter
+
+type VolthaYangAdapter struct {
+	volthaNbiClient *clients.VolthaNbiClient
+	oltAppClient    *clients.OltAppClient
+}
+
+func NewVolthaYangAdapter(nbiClient *clients.VolthaNbiClient, oltClient *clients.OltAppClient) *VolthaYangAdapter {
+	return &VolthaYangAdapter{
+		volthaNbiClient: nbiClient,
+		oltAppClient:    oltClient,
+	}
+}
+
+func (t *VolthaYangAdapter) GetDevices(ctx context.Context) ([]YangItem, error) {
+	devices, err := t.volthaNbiClient.Service.ListDevices(ctx, &empty.Empty{})
+	if err != nil {
+		err = fmt.Errorf("get-devices-failed: %v", err)
+		return nil, err
+	}
+
+	items := translateDevices(*devices)
+
+	logger.Debugw(ctx, "get-devices-success", log.Fields{"items": items})
+
+	return items, nil
+}
diff --git a/internal/core/logger.go b/internal/core/logger.go
new file mode 100644
index 0000000..0aa6eef
--- /dev/null
+++ b/internal/core/logger.go
@@ -0,0 +1,32 @@
+/*
+* Copyright 2022-present Open Networking Foundation
+
+* 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 core
+
+import (
+	"github.com/opencord/voltha-lib-go/v7/pkg/log"
+)
+
+var logger log.CLogger
+
+func init() {
+	// Setup this package so that it's log level can be modified at run time
+	var err error
+	logger, err = log.RegisterPackage(log.JSON, log.ErrorLevel, log.Fields{})
+	if err != nil {
+		panic(err)
+	}
+}
diff --git a/internal/core/translation.go b/internal/core/translation.go
new file mode 100644
index 0000000..bc7c692
--- /dev/null
+++ b/internal/core/translation.go
@@ -0,0 +1,67 @@
+/*
+* Copyright 2022-present Open Networking Foundation
+
+* 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 core
+
+import (
+	"fmt"
+
+	"github.com/opencord/voltha-protos/v5/go/voltha"
+)
+
+const (
+	DeviceAggregationModel = "bbf-device-aggregation"
+	DevicesPath            = "/" + DeviceAggregationModel + ":devices"
+	DeviceTypeOlt          = "bbf-device-types:olt"
+	DeviceTypeOnu          = "bbf-device-types:onu"
+)
+
+type YangItem struct {
+	Path  string
+	Value string
+}
+
+//getDevicePath returns the yang path to the root of the device with a specific ID
+func getDevicePath(id string) string {
+	return fmt.Sprintf("%s/device[name='%s']", DevicesPath, id)
+}
+
+//translateDevice returns a slice of yang items that represent a voltha device
+func translateDevice(device voltha.Device) []YangItem {
+	devicePath := getDevicePath(device.Id)
+
+	typeItem := YangItem{}
+	typeItem.Path = fmt.Sprintf("%s/type", devicePath)
+
+	if device.Root {
+		typeItem.Value = DeviceTypeOlt
+	} else {
+		typeItem.Value = DeviceTypeOnu
+	}
+
+	return []YangItem{typeItem}
+}
+
+//translateDevices returns a slice of yang items that represent a list of voltha devices
+func translateDevices(devices voltha.Devices) []YangItem {
+	result := []YangItem{}
+
+	for _, device := range devices.Items {
+		result = append(result, translateDevice(*device)...)
+	}
+
+	return result
+}
diff --git a/internal/core/translation_test.go b/internal/core/translation_test.go
new file mode 100644
index 0000000..fb2e751
--- /dev/null
+++ b/internal/core/translation_test.go
@@ -0,0 +1,101 @@
+/*
+* Copyright 2022-present Open Networking Foundation
+
+* 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 core
+
+import (
+	"fmt"
+	"testing"
+
+	"github.com/opencord/voltha-protos/v5/go/voltha"
+	"github.com/stretchr/testify/assert"
+)
+
+const (
+	testDeviceId = "123145abcdef"
+)
+
+func getItemWithPath(items []YangItem, path string) (value string, ok bool) {
+	for _, item := range items {
+		if item.Path == path {
+			return item.Value, true
+		}
+	}
+
+	return "", false
+}
+
+func TestDevicePath(t *testing.T) {
+	path := getDevicePath(testDeviceId)
+	assert.Equal(t, fmt.Sprintf("/bbf-device-aggregation:devices/device[name='%s']", testDeviceId), path)
+}
+
+func TestTranslateDevice(t *testing.T) {
+	olt := voltha.Device{
+		Id:   testDeviceId,
+		Root: true,
+	}
+	items := translateDevice(olt)
+
+	val, ok := getItemWithPath(items, fmt.Sprintf("%s/type", getDevicePath(testDeviceId)))
+	assert.True(t, ok, "No type item for olt")
+	assert.Equal(t, DeviceTypeOlt, val)
+
+	onu := voltha.Device{
+		Id:   testDeviceId,
+		Root: false,
+	}
+	items = translateDevice(onu)
+
+	val, ok = getItemWithPath(items, fmt.Sprintf("%s/type", getDevicePath(testDeviceId)))
+	assert.True(t, ok, "No type item for onu")
+	assert.Equal(t, DeviceTypeOnu, val)
+}
+
+func TestTranslateDevices(t *testing.T) {
+	devicesNum := 10
+
+	//Create test devices
+	devices := voltha.Devices{
+		Items: []*voltha.Device{},
+	}
+
+	for i := 0; i < devicesNum; i++ {
+		devices.Items = append(devices.Items, &voltha.Device{
+			Id:   fmt.Sprintf("%d", i),
+			Root: i%2 == 0,
+		})
+	}
+
+	//Translate them to items
+	items := translateDevices(devices)
+
+	//Check if the number of generated items is correct
+	singleDeviceItemsNum := len(translateDevice(*devices.Items[0]))
+	assert.Equal(t, singleDeviceItemsNum*devicesNum, len(items))
+
+	//Check if the content is right
+	for i := 0; i < devicesNum; i++ {
+		val, ok := getItemWithPath(items, fmt.Sprintf("%s/type", getDevicePath(devices.Items[i].Id)))
+		assert.True(t, ok, fmt.Sprintf("No type item for device %d", i))
+
+		if devices.Items[i].Root {
+			assert.Equal(t, DeviceTypeOlt, val)
+		} else {
+			assert.Equal(t, DeviceTypeOnu, val)
+		}
+	}
+}
