def _do_request(self, method, action, body=None, headers=None,
                    vsm_ip=None):
        """Handle outgoing requestes based on type"""
        if self.broken:
            raise c_exc.VSMError(reason='VSM:Internal Server Error')
        if self.inject_params and body:
            body['invalidKey'] = 'catchMeIfYouCan'
        if method == 'POST' and self.shared_net:
            return _validate_shared_net_resource(action, body)
        # For update to shared network cases, set to shared after net create
        elif (method == 'POST' and self.upd_shared_net and
              '/network-segment/' in action):
            ret = _validate_resource(action, body)
            self.shared_net = True
            return ret
        elif method == 'POST':
            return _validate_resource(action, body)
        elif method == 'GET':
            if 'virtual-port-profile' in action:
                return _policy_profile_generator(
                    self._get_total_profiles())
            else:
                raise c_exc.VSMError(reason='VSM:Internal Server Error')
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/tests/unit/ml2/drivers/cisco/n1kv/fake_client.py/TestClient._do_request/original