Russian energy major Rosneft has agreed to take control of the main oil pipeline in Iraq's Kurdistan.