An optical amplifying apparatus for optical network has automatic gain control