If subnet_id is passed at the time of port creation, use it to allocate appropriate ip address. This funcationality was already implemented for port update. With this commit, we are moving common parts to a new function and calling it from both port create and upate

Change-Id: I8cbfd0d3cd4bf59ee0b84752487d4d6bfb995e0f
Closes-Bug: 1349970
Merge "If subnet_id is passed at the time of port creation, use it to allocate appropriate ip address. This funcationality was already implemented for port update. With this commit, we are moving common parts to a new function and calling it from both port create and upate"