diff --git a/ui-react/src/api/LoopCache.js b/ui-react/src/api/LoopCache.js
index 03cec9f..c8ecca2 100644
--- a/ui-react/src/api/LoopCache.js
+++ b/ui-react/src/api/LoopCache.js
@@ -36,12 +36,34 @@
 			}
 	}
 
+	updateMicroServicePdpGroup(name, pdpGroup, pdpSubgroup) {
+			for (var policy in this.loopJsonCache["microServicePolicies"]) {
+				if (this.loopJsonCache["microServicePolicies"][policy]["name"] === name) {
+					this.loopJsonCache["microServicePolicies"][policy]["pdpGroup"] = pdpGroup;
+					this.loopJsonCache["microServicePolicies"][policy]["pdpSubgroup"] = pdpSubgroup;
+				}
+			}
+	}
+
 	updateGlobalProperties(newGlobalProperties) {
 		this.loopJsonCache["globalPropertiesJson"] = newGlobalProperties;
 	}
 
-	updateOperationalPolicyProperties(newOpProperties) {
-		this.loopJsonCache["operationalPolicies"] = newOpProperties;
+	updateOperationalPolicyProperties(name, newOpProperties) {
+		for (var policy in this.loopJsonCache["operationalPolicies"]) {
+				if (this.loopJsonCache["operationalPolicies"][policy]["name"] === name) {
+					this.loopJsonCache["operationalPolicies"][policy]["configurationsJson"] = newOpProperties;
+				}
+			}
+	}
+
+	updateOperationalPolicyPdpGroup(name, pdpGroup, pdpSubgroup) {
+		for (var policy in this.loopJsonCache["operationalPolicies"]) {
+			if (this.loopJsonCache["operationalPolicies"][policy]["name"] === name) {
+				this.loopJsonCache["operationalPolicies"][policy]["pdpGroup"] = pdpGroup;
+				this.loopJsonCache["operationalPolicies"][policy]["pdpSubgroup"] = pdpSubgroup;
+			}
+		}
 	}
 
 	getLoopName() {
@@ -51,7 +73,7 @@
 	getOperationalPolicyConfigurationJson() {
 		return this.loopJsonCache["operationalPolicies"]["0"]["configurationsJson"];
 	}
-	
+
 	getOperationalPolicyJsonSchema() {
 		return this.loopJsonCache["operationalPolicies"]["0"]["jsonRepresentation"];
 	}
@@ -97,13 +119,60 @@
 	}
 
 	getOperationalPolicyJsonRepresentationForName(name) {
-    	var opConfig = this.getOperationalPolicyForName(name);
-    	if (opConfig !== null) {
-    		return opConfig["jsonRepresentation"];
-    	}
-    	return null;
-    }
+		var opConfig = this.getOperationalPolicyForName(name);
+		if (opConfig !== null) {
+			return opConfig["jsonRepresentation"];
+		}
+		return null;
+	}
 
+	getOperationalPolicySupportedPdpgroup(name) {
+		var opConfig=this.getOperationalPolicyForName(name);
+		if (opConfig !== null) {
+			return opConfig["policyModel"]["policyPdpGroup"]["supportedPdpGroups"];
+		}
+		return null;
+	}
+
+	getOperationalPolicyPdpGroup(name) {
+		var opConfig=this.getOperationalPolicyForName(name);
+		if (opConfig !== null) {
+			return opConfig["pdpGroup"];
+		}
+		return null;
+	}
+
+	getOperationalPolicyPdpSubgroup(name) {
+		var opConfig=this.getOperationalPolicyForName(name);
+		if (opConfig !== null) {
+			return opConfig["pdpSubgroup"];
+		}
+		return null;
+	}
+
+	getMicroServiceSupportedPdpgroup(name) {
+		var microService=this.getMicroServiceForName(name);
+		if (microService !== null) {
+			return microService["policyModel"]["policyPdpGroup"]["supportedPdpGroups"];
+		}
+		return null;
+	}
+
+	getMicroServicePdpGroup(name) {
+		var microService=this.getMicroServiceForName(name);
+		if (microService !== null) {
+			return microService["pdpGroup"];
+		}
+		return null;
+	}
+
+	getMicroServicePdpSubgroup(name) {
+		var microService=this.getMicroServiceForName(name);
+		if (microService !== null) {
+			return microService["pdpSubgroup"];
+		}
+		return null;
+	}
 
 	getMicroServiceForName(name) {
 		var msProperties=this.getMicroServicePolicies();
diff --git a/ui-react/src/api/LoopCache.test.js b/ui-react/src/api/LoopCache.test.js
index 97c09fa..fc75681 100644
--- a/ui-react/src/api/LoopCache.test.js
+++ b/ui-react/src/api/LoopCache.test.js
@@ -206,18 +206,15 @@
     });
 
     it('updateOperationalPolicyProperties', () => {
-      const newOpPolicy = [{
-        "name": "OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca_new",
-        "configurationsJson": {
+      const newOpPolicy = {
           "guard_policies": {},
           "operational_policy": {
             "controlLoop": {},
             "policies": []
           }
-        }
-      }];
-      loopCache.updateOperationalPolicyProperties(newOpPolicy);
-      expect(loopCache.getOperationalPolicies()).toStrictEqual(newOpPolicy);
+        };
+      loopCache.updateOperationalPolicyProperties("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca",newOpPolicy);
+      expect(loopCache.getOperationalPolicyPropertiesForName("OPERATIONAL_h2NMX_v1_0_ResourceInstanceName1_tca")).toStrictEqual(newOpPolicy);
     });
 
     it('updateMicroServiceProperties', () => {
diff --git a/ui-react/src/components/dialogs/Policy/PolicyModal.js b/ui-react/src/components/dialogs/Policy/PolicyModal.js
index 51a6464..caae70e 100644
--- a/ui-react/src/components/dialogs/Policy/PolicyModal.js
+++ b/ui-react/src/components/dialogs/Policy/PolicyModal.js
@@ -23,6 +23,10 @@
 
 import React from 'react'
 import Button from 'react-bootstrap/Button';
+import Form from 'react-bootstrap/Form';
+import Col from 'react-bootstrap/Col';
+import Row from 'react-bootstrap/Row';
+import Select from 'react-select';
 import Modal from 'react-bootstrap/Modal';
 import styled from 'styled-components';
 import LoopService from '../../../api/LoopService';
@@ -40,7 +44,12 @@
 		jsonEditor: null,
 		policyName: this.props.match.params.policyName,
 		// This is to indicate whether it's an operational or config policy (in terms of loop instance)
-		policyInstanceType: this.props.match.params.policyInstanceType
+		policyInstanceType: this.props.match.params.policyInstanceType,
+		pdpGroup: null,
+		pdpGroupList: [],
+		pdpSubgroupList: [],
+		chosenPdpGroup: '',
+		chosenPdpSubgroup: ''
 	};
 
 	constructor(props, context) {
@@ -48,6 +57,8 @@
 		this.handleClose = this.handleClose.bind(this);
 		this.handleSave = this.handleSave.bind(this);
 		this.renderJsonEditor = this.renderJsonEditor.bind(this);
+		this.handlePdpGroupChange = this.handlePdpGroupChange.bind(this);
+		this.handlePdpSubgroupChange = this.handlePdpSubgroupChange.bind(this);
 	}
 
 	handleSave() {
@@ -63,18 +74,20 @@
 			console.info("NO validation errors found in policy data");
 			if (this.state.policyInstanceType === 'MICRO-SERVICE-POLICY') {
                 this.state.loopCache.updateMicroServiceProperties(this.state.policyName, editorData[0]);
+                this.state.loopCache.updateMicroServicePdpGroup(this.state.policyName, this.state.chosenPdpGroup, this.state.chosenPdpSubgroup);
                 LoopService.setMicroServiceProperties(this.state.loopCache.getLoopName(), this.state.loopCache.getMicroServiceForName(this.state.policyName)).then(resp => {
                     this.setState({ show: false });
                     this.props.history.push('/');
                     this.props.loadLoopFunction(this.state.loopCache.getLoopName());
                 });
 			} else if (this.state.policyInstanceType === 'OPERATIONAL-POLICY') {
-			    this.state.loopCache.updateOperationalPolicyProperties(editorData);
-            	LoopService.setOperationalPolicyProperties(this.state.loopCache.getLoopName(), this.state.loopCache.getOperationalPolicyForName(this.state.policyName)).then(resp => {
-            		this.setState({ show: false });
-            		this.props.history.push('/');
-            		this.props.loadLoopFunction(this.state.loopCache.getLoopName());
-            	});
+				this.state.loopCache.updateOperationalPolicyProperties(this.state.policyName, editorData[0]);
+				this.state.loopCache.updateOperationalPolicyPdpGroup(this.state.policyName, this.state.chosenPdpGroup, this.state.chosenPdpSubgroup);
+				LoopService.setOperationalPolicyProperties(this.state.loopCache.getLoopName(), this.state.loopCache.getOperationalPolicies()).then(resp => {
+					this.setState({ show: false });
+				this.props.history.push('/');
+					this.props.loadLoopFunction(this.state.loopCache.getLoopName());
+				});
 			}
 		}
 	}
@@ -91,14 +104,22 @@
 	renderJsonEditor() {
 		console.debug("Rendering PolicyModal ", this.state.policyName);
 		var toscaModel = {};
-	    var editorData = {};
-	    if (this.state.policyInstanceType === 'MICRO-SERVICE-POLICY') {
-            toscaModel = this.state.loopCache.getMicroServiceJsonRepresentationForName(this.state.policyName);
-            editorData = this.state.loopCache.getMicroServicePropertiesForName(this.state.policyName);
-        } else if (this.state.policyInstanceType === 'OPERATIONAL-POLICY') {
-            toscaModel = this.state.loopCache.getOperationalPolicyJsonRepresentationForName(this.state.policyName);
-            editorData = this.state.loopCache.getOperationalPolicyPropertiesForName(this.state.policyName);
-        }
+		var editorData = {};
+		var pdpGroupValues = {};
+		var chosenPdpGroupValue, chosenPdpSubgroupValue;
+		if (this.state.policyInstanceType === 'MICRO-SERVICE-POLICY') {
+			toscaModel = this.state.loopCache.getMicroServiceJsonRepresentationForName(this.state.policyName);
+			editorData = this.state.loopCache.getMicroServicePropertiesForName(this.state.policyName);
+			pdpGroupValues = this.state.loopCache.getMicroServiceSupportedPdpgroup(this.state.policyName);
+			chosenPdpGroupValue = this.state.loopCache.getMicroServicePdpGroup(this.state.policyName);
+			chosenPdpSubgroupValue = this.state.loopCache.getMicroServicePdpSubgroup(this.state.policyName);
+		} else if (this.state.policyInstanceType === 'OPERATIONAL-POLICY') {
+			toscaModel = this.state.loopCache.getOperationalPolicyJsonRepresentationForName(this.state.policyName);
+			editorData = this.state.loopCache.getOperationalPolicyPropertiesForName(this.state.policyName);
+			pdpGroupValues = this.state.loopCache.getOperationalPolicySupportedPdpgroup(this.state.policyName);
+			chosenPdpGroupValue = this.state.loopCache.getOperationalPolicyPdpGroup(this.state.policyName);
+			chosenPdpSubgroupValue = this.state.loopCache.getOperationalPolicyPdpSubgroup(this.state.policyName);
+		}
 
 		if (toscaModel == null) {
 			return;
@@ -114,10 +135,48 @@
 		JSONEditor.defaults.options.disable_array_delete_all_rows = false;
 		JSONEditor.defaults.options.show_errors = 'always';
 
-		this.setState({
-			jsonEditor: new JSONEditor(document.getElementById("editor"),
-				{ schema: toscaModel.schema, startval: editorData })
-		})
+		var pdpGroupListValues = pdpGroupValues.map(entry => {
+				return { label: Object.keys(entry)[0], value: Object.keys(entry)[0] };
+		});
+
+		if (typeof(chosenPdpGroupValue) === "undefined") {
+			this.setState({
+				jsonEditor: new JSONEditor(document.getElementById("editor"),
+					{ schema: toscaModel.schema, startval: editorData }),
+				pdpGroup: pdpGroupValues,
+				pdpGroupList: pdpGroupListValues,
+				chosenPdpGroup: chosenPdpGroupValue,
+				chosenPdpSubgroup: chosenPdpSubgroupValue
+			})
+		} else {
+			var selectedPdpGroup =	pdpGroupValues.filter(entry => (Object.keys(entry)[0] === chosenPdpGroupValue));
+			const pdpSubgroupValues = selectedPdpGroup[0][chosenPdpGroupValue].map((pdpSubgroup) => { return { label: pdpSubgroup, value: pdpSubgroup } });
+			this.setState({
+				jsonEditor: new JSONEditor(document.getElementById("editor"),
+					{ schema: toscaModel.schema, startval: editorData }),
+				pdpGroup: pdpGroupValues,
+				pdpGroupList: pdpGroupListValues,
+				pdpSubgroupList: pdpSubgroupValues,
+				chosenPdpGroup: chosenPdpGroupValue,
+				chosenPdpSubgroup: chosenPdpSubgroupValue
+			})
+		}
+	}
+
+	handlePdpGroupChange(e) {
+		var selectedPdpGroup =	this.state.pdpGroup.filter(entry => (Object.keys(entry)[0] === e.value));
+		const pdpSubgroupValues = selectedPdpGroup[0][e.value].map((pdpSubgroup) => { return { label: pdpSubgroup, value: pdpSubgroup } });
+		if (this.state.chosenPdpGroup !== e.value) {
+			this.setState({ 
+				chosenPdpGroup: e.value,
+				chosenPdpSubgroup: '',
+				pdpSubgroupList: pdpSubgroupValues
+			});
+		}
+	}
+
+	handlePdpSubgroupChange(e) {
+		this.setState({ chosenPdpSubgroup: e.value });
 	}
 
 	render() {
@@ -128,15 +187,23 @@
 				</Modal.Header>
 				<Modal.Body>
 					<div id="editor" />
-
+					<Form.Group as={Row} controlId="formPlaintextEmail">
+						<Form.Label column sm="2">Pdp Group Info</Form.Label>
+						<Col sm="3">
+							<Select value={{ label: this.state.chosenPdpGroup, value: this.state.chosenPdpGroup }} onChange={this.handlePdpGroupChange} options={this.state.pdpGroupList} />
+						</Col>
+						<Col sm="3">
+							<Select value={{ label: this.state.chosenPdpSubgroup, value: this.state.chosenPdpSubgroup }} onChange={this.handlePdpSubgroupChange} options={this.state.pdpSubgroupList} />
+						</Col>
+					</Form.Group>
 				</Modal.Body>
 				<Modal.Footer>
 					<Button variant="secondary" onClick={this.handleClose}>
 						Close
-				</Button>
+					</Button>
 					<Button variant="primary" onClick={this.handleSave}>
 						Save Changes
-	            </Button>
+					</Button>
 				</Modal.Footer>
 			</ModalStyled>
 
