- APIs created for profile operations. (insert/delete)
- VoipSystem and VoipUser profiles created for common and user specific voip parameters.

[VOL-4436], [VOL-4444]

Change-Id: I8986f44232a1edebcc4fcb1fda88da94773dd1af
diff --git a/protos/voltha_protos/common.proto b/protos/voltha_protos/common.proto
index 7ff3229..d44611f 100755
--- a/protos/voltha_protos/common.proto
+++ b/protos/voltha_protos/common.proto
@@ -6,6 +6,11 @@
 
 option java_package = "org.opencord.voltha";
 
+// Full path for KV store
+message Key {
+    string key = 1;
+}
+
 // Convey a resource identifier
 message ID {
     string id = 1;
diff --git a/protos/voltha_protos/voip_system_profile.proto b/protos/voltha_protos/voip_system_profile.proto
new file mode 100644
index 0000000..814b086
--- /dev/null
+++ b/protos/voltha_protos/voip_system_profile.proto
@@ -0,0 +1,197 @@
+// Copyright (c) 2018 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.
+
+syntax = "proto3";
+
+option go_package = "github.com/opencord/voltha-protos/v5/go/voip_system_profile";
+option java_package = "org.opencord.voltha.voip_system_profile";
+
+package voip_system_profile;
+import "google/api/annotations.proto";
+
+message VoipSystemProfileRequest {
+  string key = 1;
+  VoipSystemProfile voipSystemProfile = 2;
+}
+
+// A system wide profile for voip service that can be stored into voltha KV anytime.
+// Designed based on G988-2017 (also designed flexible to be able to be modified later on)
+message VoipSystemProfile {
+  SipConfig sipConfig = 1;
+  VoipConfig voipConfig = 2;
+}
+
+// Common voip fields are grouped here
+message VoipConfig {
+  IpHostConfig ipHostConfig = 1;
+  TcpUdpConfig tcpUdpConfig = 2;
+  VoipVoiceCtp voipVoiceCtp = 3;
+  VoipMediaProfile voipMediaProfile = 4;
+  VoiceServiceProfile voiceServiceProfile = 5;
+  RtpProfile rtpProfile = 6;
+  PptpPotsUni pptpPotsUni = 7;
+}
+
+message IpHostConfig {
+  uint32 ipOptions = 1;
+  string onuIdentifier = 2;
+  string ipAddress = 3;
+  string mask = 4;
+  string gateway = 5;
+  string primaryDns = 6;
+  string secondaryDns = 7;
+  string relayAgentOptions = 8;
+}
+
+message TcpUdpConfig {
+  uint32 protocol = 1;
+  string tosField = 2;
+}
+
+message VoipVoiceCtp {
+  uint32 signallingCode = 1;
+}
+
+message VoipMediaProfile {
+  uint32 faxMode = 1;
+  uint32 codecSelection1 = 2;
+  uint32 packetPeriodSelection1 = 3;
+  uint32 silenceSuppression1 = 4;
+  uint32 codecSelection2 = 5;
+  uint32 packetPeriodSelection2 = 6;
+  uint32 silenceSuppression2 = 7;
+  uint32 codecSelection3 = 8;
+  uint32 packetPeriodSelection3 = 9;
+  uint32 silenceSuppression3 = 10;
+  uint32 codecSelection4 = 11;
+  uint32 packetPeriodSelection4 = 12;
+  uint32 silenceSuppression4 = 13;
+  uint32 oobDtmf = 14;
+}
+
+message VoiceServiceProfile {
+  uint32 announcementType = 1;
+  uint32 jitterTarget = 2;
+  uint32 jitterBufferMax = 3;
+  bool echoCancelInd = 4;
+  uint32 pstnProtocolVariant = 5;
+  uint32 dtmfDigitLevels = 6;
+  uint32 dtmfDigitDuration = 7;
+  uint32 hookFlashMinimumTime = 8;
+}
+
+message RtpProfile {
+  uint32 localPortMin = 1;
+  uint32 localPortMax = 2;
+  string dscpMark = 3;
+  uint32 piggyBackEvents = 4;
+  uint32 toneEvents = 5;
+  uint32 dtmfEvents = 6;
+  uint32 casEvents = 7;
+}
+
+message PptpPotsUni {
+  string arc = 1;
+  string arcInterval = 2;
+  uint32 impedance = 3;
+  uint32 transmissionPath = 4;
+  sint32 rxGain = 5;
+  sint32 txGain = 6;
+  uint32 potsHoldOverTime = 7;
+  uint32 nominalFeedVoltage = 8;
+  uint32 lossOfSoftSwitch = 9;
+}
+
+// Sip specific fields are grouped here
+message SipConfig {
+  SipUserData sipUserData = 1;
+  SipAgentConfig sipAgentConfig = 2;
+  NetworkDialPlan  networkDialPlan = 3;
+  VoipFeatureAccessCodes voipFeatureAccessCodes = 4;
+  VoipApplicationServiceProfile voipApplicationServiceProfile = 5;
+}
+
+message SipUserData {
+  string userPartAor = 1;
+  UsernameAndPassword usernameAndPassword = 2;
+  string voicemailServerSipUri = 3;
+  int32 voicemailSubscriptionExpirationTime = 4;
+  int32 releaseTimer = 5;
+  int32 rohTimer = 6;
+}
+
+message SipAgentConfig {
+  string outboundProxyAddress = 1;
+  string primarySipDns = 2;
+  string secondarySipDns = 3;
+  int32 sipRegExpTime = 4;
+  int32 sipReregHeadStartTime = 5;
+  string SipRegistrar = 6;
+  string softSwitch = 7;
+  SipResponseTable sipResponseTable = 8;
+  bool sipOptionTransmitControl = 9;
+  string sipUriFormat = 10;
+  string redundantSipAgentPointer = 11;
+}
+
+message NetworkDialPlan {
+  uint32 criticalDialTimeout = 1;
+  uint32 partialDialTimeout = 2;
+  uint32 dialPlanFormat = 3;
+  DialPlanTable dialPlanTable = 4;
+}
+
+message UsernameAndPassword {
+  int32 validationScheme = 1;
+}
+
+message SipResponseTable {
+  string sipResponseCode = 1;
+  string tone = 2;
+  string textMessage = 3;
+}
+
+message DialPlanTable {
+  uint32 dialPlanId = 1;
+  uint32 action = 2;
+  string dialPlanToken = 3;
+  uint32 dialPlanTableMaxSize = 4;
+}
+
+message VoipFeatureAccessCodes {
+  string cancelCallWaiting = 1;
+  string callHold = 2;
+  string callPark = 3;
+  string callerIdActivate = 4;
+  string callerIdDeactivate = 5;
+  string doNotDisturbActivation = 6;
+  string doNotDisturbDeactivation = 7;
+  string doNotDisturbPinChange = 8;
+  string emergencyServiceNumber = 9;
+  string intercomService = 10;
+  string unattendedCallTransfer = 11;
+  string attendedCallTransfer = 12;
+}
+
+message VoipApplicationServiceProfile {
+  uint32 cidFeatures = 1;
+  uint32 callWaitingFeatures = 2;
+  uint32 callProgressOrTransferFeatures = 3;
+  uint32 callPresentationFeatures = 4;
+  uint32 directConnectFeature = 5;
+  string directConnectUriPointer = 6;
+  string bridgedLineAgentUriPointer = 7;
+  string conferenceFactoryUriPointer = 8;
+  uint32 dialToneDelayTimer = 9;
+}
\ No newline at end of file
diff --git a/protos/voltha_protos/voip_user_profile.proto b/protos/voltha_protos/voip_user_profile.proto
new file mode 100644
index 0000000..b5a48e5
--- /dev/null
+++ b/protos/voltha_protos/voip_user_profile.proto
@@ -0,0 +1,39 @@
+// Copyright (c) 2018 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.
+
+syntax = "proto3";
+
+option go_package = "github.com/opencord/voltha-protos/v5/go/voip_user_profile";
+option java_package = "org.opencord.voltha.voip_user_profile";
+
+package voip_user_profile;
+import "google/api/annotations.proto";
+
+// A user specific profile for voip service
+message VoipUserProfileRequest {
+  // for the path in KV store
+  string key = 1;
+  VoipUserProfile voipUserProfile = 2;
+}
+
+message VoipUserProfile {
+  string voipSystemProfileKey = 1;
+  string username = 2;
+  string password = 3;
+  string domain = 4;
+  string proxy = 5;
+  uint32 port = 6;
+  string sipDisplayName = 7;
+  string realm = 8;
+}
\ No newline at end of file
diff --git a/protos/voltha_protos/voltha.proto b/protos/voltha_protos/voltha.proto
index 359858e..be9ff96 100755
--- a/protos/voltha_protos/voltha.proto
+++ b/protos/voltha_protos/voltha.proto
@@ -21,6 +21,8 @@
 import "voltha_protos/openflow_13.proto";
 import "voltha_protos/events.proto";
 import "voltha_protos/extensions.proto";
+import "voltha_protos/voip_system_profile.proto";
+import "voltha_protos/voip_user_profile.proto";
 
 import "voltha_protos/omci_mib_db.proto";
 import "voltha_protos/omci_alarm_db.proto";
@@ -576,5 +578,35 @@
             body: "*"
         };
     }
+
+    // Saves or updates system wide configuration into voltha KV
+    rpc PutVoipSystemProfile(voip_system_profile.VoipSystemProfileRequest) returns(google.protobuf.Empty) {
+        option (google.api.http) = {
+            post: "/api/v1/voip_system_profile"
+            body: "*"
+        };
+    }
+
+    // Deletes the given profile from voltha KV
+    rpc DeleteVoipSystemProfile(common.Key) returns(google.protobuf.Empty) {
+        option (google.api.http) = {
+            delete: "/api/v1/voip_system_profile/{key}/delete"
+        };
+    }
+
+    // Saves or updates a profile (VOIP) into voltha KV
+    rpc PutVoipUserProfile(voip_user_profile.VoipUserProfileRequest) returns(google.protobuf.Empty) {
+        option (google.api.http) = {
+            post: "/api/v1/voip_user_profile"
+            body: "*"
+        };
+    }
+
+    // Deletes the given profile from voltha KV
+    rpc DeleteVoipUserProfile(common.Key) returns(google.protobuf.Empty) {
+        option (google.api.http) = {
+            delete: "/api/v1/voip_user_profile/{key}/delete"
+        };
+    }
 }