diff --git a/core/api/src/main/java/org/onosproject/net/OpticalBandType.java b/core/api/src/main/java/org/onosproject/net/OpticalBandType.java
new file mode 100644
index 0000000..06b5b4f
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/OpticalBandType.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2023-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.
+ *
+ * This Work is contributed by CNR within the B5G-OPEN project.
+ */
+
+package org.onosproject.net;
+
+
+/**
+ * Represents type of optical bands.
+ *
+ */
+public enum OpticalBandType {
+    L_BAND, // Starts at 184500 GHz ends at 191500 GHz
+    C_BAND, // Starts at 191500 GHz ends at 195500 GHz
+    S_BAND; // Starts at 195500 GHz ends at 205300 GHz
+}
+
diff --git a/core/api/src/main/java/org/onosproject/net/OpticalBandUtils.java b/core/api/src/main/java/org/onosproject/net/OpticalBandUtils.java
new file mode 100644
index 0000000..7f38492
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/OpticalBandUtils.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2023-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.
+ *
+ * This Work is contributed by CNR within the B5G-OPEN project.
+ */
+
+package org.onosproject.net;
+
+import org.onlab.util.Frequency;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Utils to manage OCH signal on multiple optical bands.
+ * Given an OCH signal it is mapped in one band.
+ * Start and End frequency for each band can be queried.
+ */
+public final class OpticalBandUtils {
+
+    private static final Logger log = LoggerFactory.getLogger(OpticalBandUtils.class);
+    private static final Frequency L_BAND_START_FREQ = Frequency.ofGHz(184500);
+    private static final Frequency L_BAND_STOP_FREQ = Frequency.ofGHz(191500);
+    private static final Frequency C_BAND_START_FREQ = Frequency.ofGHz(191500);
+    private static final Frequency C_BAND_STOP_FREQ = Frequency.ofGHz(195500);
+    private static final Frequency S_BAND_START_FREQ = Frequency.ofGHz(195500);
+    private static final Frequency S_BAND_STOP_FREQ = Frequency.ofGHz(205300);
+
+    // prohibit instantiation
+    private OpticalBandUtils() {}
+    /**
+     * Maps the provided OCH signal on optical band type.
+     *
+     * @param ochSignal signal to be mapped
+     * @return OpticalBandType band
+     */
+     public static OpticalBandType computeOpticalBand(OchSignal ochSignal) {
+        if (L_BAND_START_FREQ.isLessThan(ochSignal.centralFrequency())
+                && L_BAND_STOP_FREQ.isGreaterThan(ochSignal.centralFrequency())) {
+            return OpticalBandType.L_BAND;
+        }
+        if (C_BAND_START_FREQ.isLessThan(ochSignal.centralFrequency())
+                && C_BAND_STOP_FREQ.isGreaterThan(ochSignal.centralFrequency())) {
+            return OpticalBandType.C_BAND;
+        }
+        if (S_BAND_START_FREQ.isLessThan(ochSignal.centralFrequency())
+                && S_BAND_STOP_FREQ.isGreaterThan(ochSignal.centralFrequency())) {
+            return OpticalBandType.S_BAND;
+        }
+        return null;
+    }
+
+    /**
+     * Return the start frequency of the specified band.
+     *
+     * @param bandType band type to be considered
+     * @return Frequency
+     */
+    public static Frequency startFrequency(OpticalBandType bandType) {
+        switch (bandType) {
+            case L_BAND:
+                return L_BAND_START_FREQ;
+            case C_BAND:
+                return C_BAND_START_FREQ;
+            case S_BAND:
+                return S_BAND_START_FREQ;
+            default:
+                log.error("Unsupported OpticalBandType {}", bandType);
+                return null;
+        }
+    }
+
+    /**
+     * Return the end frequency of the specified band.
+     *
+     * @param bandType band type to be considered
+     * @return Frequency
+     */
+    public static Frequency stopFrequency(OpticalBandType bandType) {
+        switch (bandType) {
+            case L_BAND:
+                return L_BAND_STOP_FREQ;
+            case C_BAND:
+                return C_BAND_STOP_FREQ;
+            case S_BAND:
+                return S_BAND_STOP_FREQ;
+            default:
+                log.error("Unsupported OpticalBandType {}", bandType);
+                return null;
+        }
+    }
+}
diff --git a/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/openconfig/MultiBand10LambdaQuery.java b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/openconfig/MultiBand10LambdaQuery.java
new file mode 100644
index 0000000..3d810f0
--- /dev/null
+++ b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/openconfig/MultiBand10LambdaQuery.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2023-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.
+ *
+ * This Work is contributed by CNR within the B5G-OPEN project.
+ */
+
+package org.onosproject.drivers.odtn.openconfig;
+
+import org.onosproject.driver.optical.query.MultiBandLambdaQuery;
+import org.onosproject.net.ChannelSpacing;
+import org.onosproject.net.OchSignal;
+import org.onosproject.net.PortNumber;
+import org.slf4j.Logger;
+
+import java.util.Set;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Example lambda query for multi-band optical devices.
+ */
+public class MultiBand10LambdaQuery extends MultiBandLambdaQuery {
+
+    protected static final Logger log = getLogger(TerminalDeviceLambdaQuery.class);
+
+    @Override
+    public Set<OchSignal> queryLambdas(PortNumber port) {
+        log.debug("OPENCONFIG: queried lambdas for port {}", port);
+
+        channelSpacing = ChannelSpacing.CHL_50GHZ;
+        slotGranularity = 4;
+
+        //Generates 10 channels on each band, each channel is 50 GHz width
+        lBandLambdaCount = 10;
+        cBandLambdaCount = 10;
+        sBandLambdaCount = 10;
+
+        return super.queryLambdas(port);
+    }
+}
+
diff --git a/drivers/optical/src/main/java/org/onosproject/driver/optical/query/MultiBandLambdaQuery.java b/drivers/optical/src/main/java/org/onosproject/driver/optical/query/MultiBandLambdaQuery.java
new file mode 100644
index 0000000..19ab174
--- /dev/null
+++ b/drivers/optical/src/main/java/org/onosproject/driver/optical/query/MultiBandLambdaQuery.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2023-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.
+ *
+ * This Work is contributed by CNR within the B5G-OPEN project.
+ */
+
+package org.onosproject.driver.optical.query;
+
+import org.onlab.util.Frequency;
+import org.onosproject.net.ChannelSpacing;
+import org.onosproject.net.GridType;
+import org.onosproject.net.OchSignal;
+import org.onosproject.net.OpticalBandType;
+import org.onosproject.net.OpticalBandUtils;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.behaviour.LambdaQuery;
+import org.onosproject.net.driver.AbstractHandlerBehaviour;
+import org.onosproject.net.optical.util.OpticalChannelUtility;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.onosproject.net.OpticalBandType.L_BAND;
+import static org.onosproject.net.OpticalBandType.C_BAND;
+import static org.onosproject.net.OpticalBandType.S_BAND;
+
+
+/**
+ * Abstract multi-band WDM plan lambda query, this is a base class NOT meant to be used as driver.
+ *
+ * It generates a fixed number of channel per band.
+ *
+ */
+public class MultiBandLambdaQuery extends AbstractHandlerBehaviour implements LambdaQuery {
+
+    protected ChannelSpacing channelSpacing;
+    protected int slotGranularity;
+
+    protected int lBandLambdaCount;
+    protected int cBandLambdaCount;
+    protected int sBandLambdaCount;
+
+    @Override
+    public Set<OchSignal> queryLambdas(PortNumber port) {
+
+        Set<OchSignal> lambdas = new HashSet<>();
+
+        addChannelsFromStartFreq(lambdas, L_BAND, lBandLambdaCount);
+        addChannelsFromStartFreq(lambdas, C_BAND, cBandLambdaCount);
+        addChannelsFromStartFreq(lambdas, S_BAND, sBandLambdaCount);
+
+        return lambdas;
+    }
+
+    /**
+     * Adds a number lambdaCount of new channels in band bandType to the set lambdas.
+     *
+     * @param lambdas
+     * @param bandType
+     * @param lambdaCount
+     */
+    private void addChannelsFromStartFreq(Set<OchSignal> lambdas, OpticalBandType bandType, int lambdaCount) {
+
+        Frequency startFreq = OpticalBandUtils.startFrequency(bandType);
+
+        for (int i = 0; i <= lambdaCount; i++) {
+            lambdas.add(OpticalChannelUtility.createOchSignalFromBounds(
+                    startFreq.add(channelSpacing.frequency().multiply(i)),
+                    startFreq.add(channelSpacing.frequency().multiply(i + 1)),
+                    GridType.DWDM,
+                    channelSpacing));
+        }
+    }
+}
